forked from lix-project/hydra
evaluate-basic.t: move to makeAndEvaluateJobset
This commit is contained in:
parent
adfe74b76a
commit
7333d444c6
1 changed files with 22 additions and 13 deletions
|
@ -5,22 +5,31 @@ use Setup;
|
||||||
use Test2::V0;
|
use Test2::V0;
|
||||||
|
|
||||||
my $ctx = test_context();
|
my $ctx = test_context();
|
||||||
my $db = $ctx->db;
|
|
||||||
|
|
||||||
my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
|
my $builds = $ctx->makeAndEvaluateJobset(
|
||||||
|
expression => "basic.nix",
|
||||||
|
build => 1
|
||||||
|
);
|
||||||
|
|
||||||
# Most basic test case, no parameters
|
subtest "Build: succeed_with_failed" => sub {
|
||||||
my $jobset = createBaseJobset("basic", "basic.nix", $ctx->jobsdir);
|
my $build = $builds->{"succeed_with_failed"};
|
||||||
|
|
||||||
ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0");
|
is($build->finished, 1, "Build should be finished.");
|
||||||
is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds");
|
is($build->buildstatus, 6, "succeeeded-but-failed should have buildstatus 6.");
|
||||||
|
};
|
||||||
|
|
||||||
for my $build (queuedBuildsForJobset($jobset)) {
|
subtest "Build: empty_dir" => sub {
|
||||||
ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with return code 0");
|
my $build = $builds->{"empty_dir"};
|
||||||
my $newbuild = $db->resultset('Builds')->find($build->id);
|
|
||||||
is($newbuild->finished, 1, "Build '".$build->job."' from jobs/basic.nix should be finished.");
|
is($build->finished, 1, "Build should be finished.");
|
||||||
my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;
|
is($build->buildstatus, 0, "Should have succeeded.");
|
||||||
is($newbuild->buildstatus, $expected, "Build '".$build->job."' from jobs/basic.nix should have buildstatus $expected.");
|
};
|
||||||
}
|
|
||||||
|
subtest "Build: fails" => sub {
|
||||||
|
my $build = $builds->{"fails"};
|
||||||
|
|
||||||
|
is($build->finished, 1, "Build should be finished.");
|
||||||
|
is($build->buildstatus, 1, "Should have failed.");
|
||||||
|
};
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in a new issue