From cb8929b7ed3d0c868bbe3c51758ca535302a9ddb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 16 Jun 2021 11:48:49 -0400 Subject: [PATCH] Tighten up 'should exit with return code' --- t/Controller/Build/evals.t | 2 +- t/Controller/Jobset/channel.t | 2 +- t/build-products.t | 2 +- t/evaluate-basic.t | 2 +- t/evaluate-dependent-jobsets.t | 4 ++-- t/plugins/runcommand.t | 2 +- t/queue-runner/default-machine-file.t | 2 +- t/queue-runner/notifications.t | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/t/Controller/Build/evals.t b/t/Controller/Build/evals.t index f44d5733..b12e00c6 100644 --- a/t/Controller/Build/evals.t +++ b/t/Controller/Build/evals.t @@ -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"); 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 { my $evals = request(GET '/build/' . $build->id . '/evals'); diff --git a/t/Controller/Jobset/channel.t b/t/Controller/Jobset/channel.t index c632cf55..cb0a5952 100644 --- a/t/Controller/Jobset/channel.t +++ b/t/Controller/Jobset/channel.t @@ -29,7 +29,7 @@ ok(evalSucceeds($jobset)); is(nrQueuedBuildsForJobset($jobset), 4); 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); is($newbuild->finished, 1, "Build '".$build->job."' should be finished."); is($newbuild->buildstatus, 0, "Build '".$build->job."' should have buildstatus 0."); diff --git a/t/build-products.t b/t/build-products.t index 0f558d86..6987b9df 100644 --- a/t/build-products.t +++ b/t/build-products.t @@ -21,7 +21,7 @@ is(nrQueuedBuildsForJobset($jobset), 2, "Evaluating jobs/build-products.nix shou for my $build (queuedBuildsForJobset($jobset)) { 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); is($newbuild->finished, 1, "Build should have finished"); diff --git a/t/evaluate-basic.t b/t/evaluate-basic.t index 85d5547b..c12709b2 100644 --- a/t/evaluate-basic.t +++ b/t/evaluate-basic.t @@ -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"); 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); 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; diff --git a/t/evaluate-dependent-jobsets.t b/t/evaluate-dependent-jobsets.t index 0bf3a2f0..c5a4085d 100644 --- a/t/evaluate-dependent-jobsets.t +++ b/t/evaluate-dependent-jobsets.t @@ -21,7 +21,7 @@ subtest "For the 'build1' job" => sub { my ($build) = queuedBuildsForJobset($jobset); 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); is($newbuild->finished, 1, "Build should be finished."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); @@ -33,7 +33,7 @@ subtest "For the 'build2' job" => sub { my ($build) = queuedBuildsForJobset($jobset); 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); is($newbuild->finished, 1, "Build should be finished."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); diff --git a/t/plugins/runcommand.t b/t/plugins/runcommand.t index 7f5f4cb1..8a512b32 100644 --- a/t/plugins/runcommand.t +++ b/t/plugins/runcommand.t @@ -30,7 +30,7 @@ is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/runcommand.nix should r (my $build) = queuedBuildsForJobset($jobset); 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); is($newbuild->finished, 1, "Build should be finished."); is($newbuild->buildstatus, 0, "Build should have buildstatus 0."); diff --git a/t/queue-runner/default-machine-file.t b/t/queue-runner/default-machine-file.t index d4d3f3df..d57f1816 100644 --- a/t/queue-runner/default-machine-file.t +++ b/t/queue-runner/default-machine-file.t @@ -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"); 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); 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; diff --git a/t/queue-runner/notifications.t b/t/queue-runner/notifications.t index 3c43bceb..f9d36361 100644 --- a/t/queue-runner/notifications.t +++ b/t/queue-runner/notifications.t @@ -88,7 +88,7 @@ my @builds = queuedBuildsForJobset($jobset); subtest "Build: substitutable, canbesubstituted" => sub { 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); is($newbuild->finished, 1, "Build should be finished."); @@ -107,7 +107,7 @@ subtest "Build: substitutable, canbesubstituted" => sub { subtest "Build: not substitutable, unsubstitutable" => sub { 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); is($newbuild->finished, 1, "Build should be finished.");