Merge pull request #940 from regnat/test-with-remote-dest-store

Run the tests with a remote dest store
This commit is contained in:
Graham Christensen 2021-04-29 07:27:42 -04:00 committed by GitHub
commit 29028258e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -5,7 +5,9 @@ use IO::Uncompress::Bunzip2 qw(bunzip2);
use Archive::Tar; use Archive::Tar;
use JSON qw(decode_json); use JSON qw(decode_json);
use Data::Dumper; use Data::Dumper;
my %ctx = test_init(); my %ctx = test_init(
use_external_destination_store => 0
);
require Hydra::Schema; require Hydra::Schema;
require Hydra::Model::DB; require Hydra::Model::DB;

View file

@ -20,6 +20,9 @@ our @EXPORT = qw(test_init hydra_setup nrBuildsForJobset queuedBuildsForJobset
# #
# * hydra_config: configuration for the Hydra processes for your test. # * hydra_config: configuration for the Hydra processes for your test.
# * nix_config: text to include in the test's nix.conf # * 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 # This clears several environment variables and sets them to ephemeral
# values: a temporary database, temporary Nix store, temporary Hydra # values: a temporary database, temporary Nix store, temporary Hydra
@ -54,6 +57,9 @@ sub test_init {
$ENV{'HYDRA_CONFIG'} = "$dir/hydra.conf"; $ENV{'HYDRA_CONFIG'} = "$dir/hydra.conf";
open(my $fh, '>', $ENV{'HYDRA_CONFIG'}) or die "Could not open file '" . $ENV{'HYDRA_CONFIG'}. " $!"; open(my $fh, '>', $ENV{'HYDRA_CONFIG'}) or die "Could not open file '" . $ENV{'HYDRA_CONFIG'}. " $!";
if ($opts{'use_external_destination_store'} // 1) {
print $fh "store_uri = file:$dir/nix/dest-store\n"
}
print $fh $opts{'hydra_config'} || ""; print $fh $opts{'hydra_config'} || "";
close $fh; close $fh;