From d6354cbe1f13df7f6215817039a9e0b299c0474f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Jun 2015 11:47:56 +0200 Subject: [PATCH] Fix Perl error in tests.api Doing "su hydra" causes Perl to be invoked with a wrong PERL5LIB (pointing to root's profile), leading to "Can't locate strict.pm". --- release.nix | 6 +++--- tests/api-test.pl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/release.nix b/release.nix index e10380c3..4668efc3 100644 --- a/release.nix +++ b/release.nix @@ -197,7 +197,7 @@ in rec { # Create an admin account and some other state. $machine->succeed - ( "su hydra -c \"hydra-create-user root --email-address 'e.dolstra\@tudelft.nl' --password foobar --role admin\"" + ( "su - hydra -c \"hydra-create-user root --email-address 'alice\@example.org' --password foobar --role admin\"" , "mkdir /run/jobset /tmp/nix" , "chmod 755 /run/jobset /tmp/nix" , "cp ${./tests/api-test.nix} /run/jobset/default.nix" @@ -207,11 +207,11 @@ in rec { # Start the web interface with some weird settings. $machine->succeed("systemctl stop hydra-server hydra-evaluator hydra-queue-runner"); - $machine->mustSucceed("su hydra -c 'NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix DBIC_TRACE=1 hydra-server -d' >&2 &"); + $machine->mustSucceed("su - hydra -c 'NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix NIX_REMOTE= DBIC_TRACE=1 hydra-server -d' >&2 &"); $machine->waitForOpenPort("3000"); # Run the API tests. - $machine->mustSucceed("su hydra -c 'perl ${./tests/api-test.pl}' >&2"); + $machine->mustSucceed("su - hydra -c 'perl ${./tests/api-test.pl}' >&2"); ''; }); diff --git a/tests/api-test.pl b/tests/api-test.pl index faf23ee1..4ee2dd7a 100644 --- a/tests/api-test.pl +++ b/tests/api-test.pl @@ -49,7 +49,7 @@ ok(exists $jobset->{jobsetinputs}->{"my-src"}, "The new jobset has a 'my-src' in ok($jobset->{jobsetinputs}->{"my-src"}->{jobsetinputalts}->[0] eq "/run/jobset", "The 'my-src' input is in /run/jobset"); -system("NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix hydra-evaluator sample default"); +system("NIX_STORE_DIR=/tmp/nix/store NIX_LOG_DIR=/tmp/nix/var/log/nix NIX_STATE_DIR=/tmp/nix/var/nix NIX_REMOTE= hydra-evaluator sample default"); $result = request_json({ uri => '/jobset/sample/default/evals' }); ok($result->code() == 200, "Can get evals of a jobset"); my $evals = decode_json($result->content())->{evals};