From 0d3977866e14b9bd912b738a82ed6fd5184fcd88 Mon Sep 17 00:00:00 2001 From: regnat Date: Wed, 28 Apr 2021 12:11:55 +0200 Subject: [PATCH 1/4] Run the tests with a remote dest store Set `dest_store` in the test hydra config, so that the testsuite ensures that the distinction between the local store and the destination store is properly taken into account. Fix #938 --- t/lib/Setup.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/t/lib/Setup.pm b/t/lib/Setup.pm index b5236978..ba34bb1c 100644 --- a/t/lib/Setup.pm +++ b/t/lib/Setup.pm @@ -54,6 +54,7 @@ sub test_init { $ENV{'HYDRA_CONFIG'} = "$dir/hydra.conf"; open(my $fh, '>', $ENV{'HYDRA_CONFIG'}) or die "Could not open file '" . $ENV{'HYDRA_CONFIG'}. " $!"; + print $fh "store_uri = file:$dir/nix/dest-store\n"; print $fh $opts{'hydra_config'} || ""; close $fh; From 7af63658f15b1c9abeac195ab466f9320a906415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Hufschmitt?= Date: Thu, 29 Apr 2021 07:06:55 +0200 Subject: [PATCH 2/4] tests: Make the external destination store optional Co-authored-by: Graham Christensen --- t/lib/Setup.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/lib/Setup.pm b/t/lib/Setup.pm index ba34bb1c..28181e96 100644 --- a/t/lib/Setup.pm +++ b/t/lib/Setup.pm @@ -54,7 +54,9 @@ sub test_init { $ENV{'HYDRA_CONFIG'} = "$dir/hydra.conf"; open(my $fh, '>', $ENV{'HYDRA_CONFIG'}) or die "Could not open file '" . $ENV{'HYDRA_CONFIG'}. " $!"; - print $fh "store_uri = file:$dir/nix/dest-store\n"; + if ($opts{'use_external_destination_store'} // 1) { + print $fh "store_uri = file:$dir/nix/dest-store\n" + } print $fh $opts{'hydra_config'} || ""; close $fh; From 9c787e5e94f0d48ce194f7d49a6c9e4b18f0d3c2 Mon Sep 17 00:00:00 2001 From: regnat Date: Thu, 29 Apr 2021 07:12:07 +0200 Subject: [PATCH 3/4] Document the use_external_destination_store test_init param --- t/lib/Setup.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/lib/Setup.pm b/t/lib/Setup.pm index 28181e96..151e3d61 100644 --- a/t/lib/Setup.pm +++ b/t/lib/Setup.pm @@ -20,6 +20,9 @@ our @EXPORT = qw(test_init hydra_setup nrBuildsForJobset queuedBuildsForJobset # # * hydra_config: configuration for the Hydra processes for your test. # * nix_config: text to include in the test's nix.conf +# * use_external_destination_store: Boolean indicating whether hydra should +# use a destination store different from the evaluation store. +# True by default. # # This clears several environment variables and sets them to ephemeral # values: a temporary database, temporary Nix store, temporary Hydra From bf3e1cf77b72d40639593f47a1c974acf5797af2 Mon Sep 17 00:00:00 2001 From: regnat Date: Thu, 29 Apr 2021 07:18:00 +0200 Subject: [PATCH 4/4] Disable the remote dest store for the channel test Looks like feature is only works when the destination store is the local store --- t/Controller/Jobset/channel.t | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/Controller/Jobset/channel.t b/t/Controller/Jobset/channel.t index 2b034025..c632cf55 100644 --- a/t/Controller/Jobset/channel.t +++ b/t/Controller/Jobset/channel.t @@ -5,7 +5,9 @@ use IO::Uncompress::Bunzip2 qw(bunzip2); use Archive::Tar; use JSON qw(decode_json); use Data::Dumper; -my %ctx = test_init(); +my %ctx = test_init( + use_external_destination_store => 0 +); require Hydra::Schema; require Hydra::Model::DB;