tests: replace the flat list of contexts with a hash

This way we can return more values without breaking callers.
This commit is contained in:
Graham Christensen 2021-02-25 19:26:38 -05:00 committed by Cole Helbling
parent 26cfe624d5
commit f08d0be1bd
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C
5 changed files with 8 additions and 5 deletions

View file

@ -2,7 +2,7 @@ use strict;
use Cwd; use Cwd;
use Setup; use Setup;
(my $datadir, my $pgsql) = test_init(); my %ctx = test_init();
require Hydra::Schema; require Hydra::Schema;
require Hydra::Model::DB; require Hydra::Model::DB;

View file

@ -3,7 +3,7 @@ use strict;
use Cwd; use Cwd;
use Setup; use Setup;
(my $datadir, my $pgsql) = test_init(); my %ctx = test_init();
require Hydra::Schema; require Hydra::Schema;
require Hydra::Model::DB; require Hydra::Model::DB;

View file

@ -2,7 +2,7 @@ use strict;
use Cwd; use Cwd;
use Setup; use Setup;
(my $datadir, my $pgsql) = test_init(); my %ctx = test_init();
require Hydra::Schema; require Hydra::Schema;
require Hydra::Model::DB; require Hydra::Model::DB;

View file

@ -62,7 +62,10 @@ sub test_init {
); );
$ENV{'HYDRA_DBI'} = $pgsql->dsn; $ENV{'HYDRA_DBI'} = $pgsql->dsn;
system("hydra-init") == 0 or die; system("hydra-init") == 0 or die;
return ($dir, $pgsql); return (
tmpdir => $dir,
db => $pgsql
);
} }
sub captureStdoutStderr { sub captureStdoutStderr {

View file

@ -5,7 +5,7 @@ use Cwd;
use JSON; use JSON;
use Setup; use Setup;
(my $datadir, my $pgsql) = test_init( my %ctx = test_init(
hydra_config => q| hydra_config => q|
<runcommand> <runcommand>
command = cp "$HYDRA_JSON" "$HYDRA_DATA/joboutput.json" command = cp "$HYDRA_JSON" "$HYDRA_DATA/joboutput.json"