Fix tests
Use $NIX_REMOTE instead of the legacy environment variables.
This commit is contained in:
parent
e06c480fd6
commit
c72bed5cb4
|
@ -53,16 +53,19 @@ sub new {
|
|||
my $hydra_config = $opts{'hydra_config'} || "";
|
||||
$hydra_config = "queue_runner_metrics_address = 127.0.0.1:0\n" . $hydra_config;
|
||||
if ($opts{'use_external_destination_store'} // 1) {
|
||||
$hydra_config = "store_uri = file:$dir/nix/dest-store\n" . $hydra_config;
|
||||
$hydra_config = "store_uri = file://$dir/nix/dest-store\n" . $hydra_config;
|
||||
}
|
||||
|
||||
write_file($ENV{'HYDRA_CONFIG'}, $hydra_config);
|
||||
|
||||
$ENV{'NIX_LOG_DIR'} = "$dir/nix/var/log/nix";
|
||||
my $nix_store_dir = "$dir/nix/store";
|
||||
my $nix_state_dir = "$dir/nix/var/nix";
|
||||
my $nix_log_dir = "$dir/nix/var/log/nix";
|
||||
|
||||
$ENV{'NIX_REMOTE_SYSTEMS'} = '';
|
||||
$ENV{'NIX_REMOTE'} = '';
|
||||
$ENV{'NIX_STATE_DIR'} = "$dir/nix/var/nix";
|
||||
$ENV{'NIX_STORE_DIR'} = "$dir/nix/store";
|
||||
$ENV{'NIX_REMOTE'} = "local?store=$nix_store_dir&state=$nix_state_dir&log=$nix_log_dir";
|
||||
$ENV{'NIX_STATE_DIR'} = $nix_state_dir; # FIXME: remove
|
||||
$ENV{'NIX_STORE_DIR'} = $nix_store_dir; # FIXME: remove
|
||||
|
||||
my $pgsql = Test::PostgreSQL->new(
|
||||
extra_initdb_args => "--locale C.UTF-8"
|
||||
|
@ -73,7 +76,8 @@ sub new {
|
|||
_db => undef,
|
||||
db_handle => $pgsql,
|
||||
tmpdir => $dir,
|
||||
nix_state_dir => "$dir/nix/var/nix",
|
||||
nix_state_dir => $nix_state_dir,
|
||||
nix_log_dir => $nix_log_dir,
|
||||
testdir => abs_path(dirname(__FILE__) . "/.."),
|
||||
jobsdir => abs_path(dirname(__FILE__) . "/../jobs")
|
||||
}, $class;
|
||||
|
|
|
@ -33,9 +33,6 @@ my $ctx = test_context(
|
|||
# the build locally.
|
||||
|
||||
subtest "Pre-build the job, upload to the cache, and then delete locally" => sub {
|
||||
my $scratchlogdir = File::Temp->newdir();
|
||||
$ENV{'NIX_LOG_DIR'} = "$scratchlogdir";
|
||||
|
||||
my $outlink = $ctx->tmpdir . "/basic-canbesubstituted";
|
||||
is(system('nix-build', $ctx->jobsdir . '/notifications.nix', '-A', 'canbesubstituted', '--out-link', $outlink), 0, "Building notifications.nix succeeded");
|
||||
is(system('nix', 'copy', '--to', "file://${binarycachedir}", $outlink), 0, "Copying the closure to the binary cache succeeded");
|
||||
|
@ -46,6 +43,7 @@ subtest "Pre-build the job, upload to the cache, and then delete locally" => sub
|
|||
is(system('nix', 'log', $outpath), 0, "Reading the output's log succeeds");
|
||||
is(system('nix-store', '--delete', $outpath), 0, "Deleting the notifications.nix output succeeded");
|
||||
is(system("nix-collect-garbage"), 0, "Delete all the system's garbage");
|
||||
File::Path::rmtree($ctx->{nix_log_dir});
|
||||
};
|
||||
|
||||
subtest "Ensure substituting the job works, but reading the log fails" => sub {
|
||||
|
|
Loading…
Reference in a new issue