From f08d0be1bd63c91526affac99e764b1dd0453c3a Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 25 Feb 2021 19:26:38 -0500 Subject: [PATCH] tests: replace the flat list of contexts with a hash This way we can return more values without breaking callers. --- tests/build-products.t | 2 +- tests/evaluate-basic.t | 2 +- tests/evaluate-dependent-jobsets.t | 2 +- tests/lib/Setup.pm | 5 ++++- tests/plugins/runcommand.t | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/build-products.t b/tests/build-products.t index 3431324c..5f1610f9 100644 --- a/tests/build-products.t +++ b/tests/build-products.t @@ -2,7 +2,7 @@ use strict; use Cwd; use Setup; -(my $datadir, my $pgsql) = test_init(); +my %ctx = test_init(); require Hydra::Schema; require Hydra::Model::DB; diff --git a/tests/evaluate-basic.t b/tests/evaluate-basic.t index 0d58d08f..d143b425 100644 --- a/tests/evaluate-basic.t +++ b/tests/evaluate-basic.t @@ -3,7 +3,7 @@ use strict; use Cwd; use Setup; -(my $datadir, my $pgsql) = test_init(); +my %ctx = test_init(); require Hydra::Schema; require Hydra::Model::DB; diff --git a/tests/evaluate-dependent-jobsets.t b/tests/evaluate-dependent-jobsets.t index 279e1f33..fa849258 100644 --- a/tests/evaluate-dependent-jobsets.t +++ b/tests/evaluate-dependent-jobsets.t @@ -2,7 +2,7 @@ use strict; use Cwd; use Setup; -(my $datadir, my $pgsql) = test_init(); +my %ctx = test_init(); require Hydra::Schema; require Hydra::Model::DB; diff --git a/tests/lib/Setup.pm b/tests/lib/Setup.pm index c697a258..3d1ef0fd 100644 --- a/tests/lib/Setup.pm +++ b/tests/lib/Setup.pm @@ -62,7 +62,10 @@ sub test_init { ); $ENV{'HYDRA_DBI'} = $pgsql->dsn; system("hydra-init") == 0 or die; - return ($dir, $pgsql); + return ( + tmpdir => $dir, + db => $pgsql + ); } sub captureStdoutStderr { diff --git a/tests/plugins/runcommand.t b/tests/plugins/runcommand.t index de78cb83..7788d5c5 100644 --- a/tests/plugins/runcommand.t +++ b/tests/plugins/runcommand.t @@ -5,7 +5,7 @@ use Cwd; use JSON; use Setup; -(my $datadir, my $pgsql) = test_init( +my %ctx = test_init( hydra_config => q| command = cp "$HYDRA_JSON" "$HYDRA_DATA/joboutput.json"