Tighten up 'should exit with return code'

This commit is contained in:
Graham Christensen 2021-06-16 11:48:49 -04:00
parent bf5c76feb6
commit cb8929b7ed
8 changed files with 10 additions and 10 deletions

View file

@ -23,7 +23,7 @@ ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit w
is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds"); is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds");
my ($build, @builds) = queuedBuildsForJobset($jobset); my ($build, @builds) = queuedBuildsForJobset($jobset);
ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with code 0"); ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with return code 0");
subtest "/build/ID/evals" => sub { subtest "/build/ID/evals" => sub {
my $evals = request(GET '/build/' . $build->id . '/evals'); my $evals = request(GET '/build/' . $build->id . '/evals');

View file

@ -29,7 +29,7 @@ ok(evalSucceeds($jobset));
is(nrQueuedBuildsForJobset($jobset), 4); is(nrQueuedBuildsForJobset($jobset), 4);
for my $build (queuedBuildsForJobset($jobset)) { for my $build (queuedBuildsForJobset($jobset)) {
ok(runBuild($build), "Build '".$build->job."' should exit with code 0"); ok(runBuild($build), "Build '".$build->job."' should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build '".$build->job."' should be finished."); is($newbuild->finished, 1, "Build '".$build->job."' should be finished.");
is($newbuild->buildstatus, 0, "Build '".$build->job."' should have buildstatus 0."); is($newbuild->buildstatus, 0, "Build '".$build->job."' should have buildstatus 0.");

View file

@ -21,7 +21,7 @@ is(nrQueuedBuildsForJobset($jobset), 2, "Evaluating jobs/build-products.nix shou
for my $build (queuedBuildsForJobset($jobset)) { for my $build (queuedBuildsForJobset($jobset)) {
subtest "For the build job '" . $build->job . "'" => sub { subtest "For the build job '" . $build->job . "'" => sub {
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should have finished"); is($newbuild->finished, 1, "Build should have finished");

View file

@ -21,7 +21,7 @@ ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit w
is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds"); is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds");
for my $build (queuedBuildsForJobset($jobset)) { for my $build (queuedBuildsForJobset($jobset)) {
ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with code 0"); ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build '".$build->job."' from jobs/basic.nix should be finished."); is($newbuild->finished, 1, "Build '".$build->job."' from jobs/basic.nix should be finished.");
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0; my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;

View file

@ -21,7 +21,7 @@ subtest "For the 'build1' job" => sub {
my ($build) = queuedBuildsForJobset($jobset); my ($build) = queuedBuildsForJobset($jobset);
is($build->job, "build1", "Verify the only job we got is for 'build1'"); is($build->job, "build1", "Verify the only job we got is for 'build1'");
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should be finished."); is($newbuild->finished, 1, "Build should be finished.");
is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0.");
@ -33,7 +33,7 @@ subtest "For the 'build2' job" => sub {
my ($build) = queuedBuildsForJobset($jobset); my ($build) = queuedBuildsForJobset($jobset);
is($build->job, "build2", "Verify the only job we got is for 'build2'"); is($build->job, "build2", "Verify the only job we got is for 'build2'");
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should be finished."); is($newbuild->finished, 1, "Build should be finished.");
is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0.");

View file

@ -30,7 +30,7 @@ is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/runcommand.nix should r
(my $build) = queuedBuildsForJobset($jobset); (my $build) = queuedBuildsForJobset($jobset);
is($build->job, "metrics", "The only job should be metrics"); is($build->job, "metrics", "The only job should be metrics");
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should be finished."); is($newbuild->finished, 1, "Build should be finished.");
is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0.");

View file

@ -24,7 +24,7 @@ ok(evalSucceeds($jobset), "Evaluating jobs/default-machine-file.ni
is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/default-machine-file.nix should result in 1 build"); is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/default-machine-file.nix should result in 1 build");
for my $build (queuedBuildsForJobset($jobset)) { for my $build (queuedBuildsForJobset($jobset)) {
ok(runBuild($build), "Build '".$build->job."' from jobs/default-machine-file.nix should exit with code 0"); ok(runBuild($build), "Build '".$build->job."' from jobs/default-machine-file.nix should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build '".$build->job."' from jobs/default-machine-file.nix should be finished."); is($newbuild->finished, 1, "Build '".$build->job."' from jobs/default-machine-file.nix should be finished.");
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0; my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;

View file

@ -88,7 +88,7 @@ my @builds = queuedBuildsForJobset($jobset);
subtest "Build: substitutable, canbesubstituted" => sub { subtest "Build: substitutable, canbesubstituted" => sub {
my ($build) = grep { $_->nixname eq "can-be-substituted" } @builds; my ($build) = grep { $_->nixname eq "can-be-substituted" } @builds;
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should be finished."); is($newbuild->finished, 1, "Build should be finished.");
@ -107,7 +107,7 @@ subtest "Build: substitutable, canbesubstituted" => sub {
subtest "Build: not substitutable, unsubstitutable" => sub { subtest "Build: not substitutable, unsubstitutable" => sub {
my ($build) = grep { $_->nixname eq "unsubstitutable" } @builds; my ($build) = grep { $_->nixname eq "unsubstitutable" } @builds;
ok(runBuild($build), "Build should exit with code 0"); ok(runBuild($build), "Build should exit with return code 0");
my $newbuild = $db->resultset('Builds')->find($build->id); my $newbuild = $db->resultset('Builds')->find($build->id);
is($newbuild->finished, 1, "Build should be finished."); is($newbuild->finished, 1, "Build should be finished.");