From 48d6f0de2ab94f728d287b9c9670c4d237e7c0f6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 12 Aug 2015 15:40:47 +0200 Subject: [PATCH] Fix the API test --- release.nix | 6 +++--- tests/api-test.pl | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/release.nix b/release.nix index 84306108..b4685d26 100644 --- a/release.nix +++ b/release.nix @@ -13,6 +13,7 @@ let { imports = [ ./hydra-module.nix ]; virtualisation.memorySize = 1024; + virtualisation.writableStore = true; services.hydra.enable = true; services.hydra.package = hydraPkg; @@ -216,9 +217,8 @@ in rec { , "chown -R hydra /run/jobset /tmp/nix" ); - # 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 NIX_REMOTE= DBIC_TRACE=1 hydra-server -d' >&2 &"); + $machine->succeed("systemctl stop hydra-evaluator hydra-queue-runner"); + $machine->waitForJob("hydra-server"); $machine->waitForOpenPort("3000"); # Run the API tests. diff --git a/tests/api-test.pl b/tests/api-test.pl index 4ee2dd7a..99f05780 100644 --- a/tests/api-test.pl +++ b/tests/api-test.pl @@ -49,20 +49,18 @@ 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 NIX_REMOTE= hydra-evaluator sample default"); +system("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}; my $eval = $evals->[0]; ok($eval->{hasnewbuilds} == 1, "The first eval of a jobset has new builds"); -# Ugh, cached for 30s -sleep 30; -system("echo >> /run/jobset/default.nix; 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("echo >> /run/jobset/default.nix; hydra-evaluator sample default"); my $evals = decode_json(request_json({ uri => '/jobset/sample/default/evals' })->content())->{evals}; ok($evals->[0]->{jobsetevalinputs}->{"my-src"}->{revision} != $evals->[1]->{jobsetevalinputs}->{"my-src"}->{revision}, "Changing a jobset source changes its revision"); my $build = decode_json(request_json({ uri => "/build/" . $evals->[0]->{builds}->[0] })->content()); ok($build->{job} eq "job", "The build's job name is job"); ok($build->{finished} == 0, "The build isn't finished yet"); -ok($build->{buildoutputs}->{out}->{path} =~ /^\/tmp\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the nix store and named 'job'"); +ok($build->{buildoutputs}->{out}->{path} =~ /^\/nix\/store\/[a-zA-Z0-9]{32}-job$/, "The build's outpath is in the Nix store and named 'job'");