From b1da48eac8d9be0075d47ec5a9821cba44561599 Mon Sep 17 00:00:00 2001 From: Oliver Kurz Date: Mon, 20 Dec 2021 13:34:30 +0100 Subject: [PATCH] Remove unused 'dsn' function and its usage Tests did not cover the 'dsn' function anyway. Verified by calling ``` env OPENQA_BASEDIR=$PWD/t/data OPENQA_DATABASE=test script/openqa-gru ``` locally. --- lib/OpenQA/Schema.pm | 5 ----- lib/OpenQA/Shared/Plugin/Gru.pm | 10 ++-------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/OpenQA/Schema.pm b/lib/OpenQA/Schema.pm index 3cc3e8ad7e9..e5c6283dd85 100644 --- a/lib/OpenQA/Schema.pm +++ b/lib/OpenQA/Schema.pm @@ -51,11 +51,6 @@ sub disconnect_db () { $SINGLETON = undef; } -sub dsn { - my $self = shift; - return $self->storage->connect_info->[0]->{dsn}; -} - sub deploy ($self, $force_overwrite = 0) { # lock config file to ensure only one thing will deploy/upgrade DB at once # we use a file in prjdir/db as the lock file as the install process and diff --git a/lib/OpenQA/Shared/Plugin/Gru.pm b/lib/OpenQA/Shared/Plugin/Gru.pm index ae2625e41e4..33a0a05b7ae 100644 --- a/lib/OpenQA/Shared/Plugin/Gru.pm +++ b/lib/OpenQA/Shared/Plugin/Gru.pm @@ -45,14 +45,8 @@ sub register ($self, $app, $config) { my $schema = $app->schema; my $conn = Mojo::Pg->new; - if (ref $schema->storage->connect_info->[0] eq 'HASH') { - $self->dsn($schema->dsn); - $conn->username($schema->storage->connect_info->[0]->{user}); - $conn->password($schema->storage->connect_info->[0]->{password}); - } - else { - $self->dsn($schema->storage->connect_info->[0]); - } + my $connect_info = $schema->storage->connect_info->[0]; + $self->dsn($connect_info); $conn->dsn($self->dsn()); # set the search path in accordance with the test setup done in OpenQA::Test::Database