2021-02-22 21:52:38 +00:00
|
|
|
use feature 'unicode_strings';
|
|
|
|
use strict;
|
|
|
|
use Setup;
|
|
|
|
|
2021-02-26 00:26:38 +00:00
|
|
|
my %ctx = test_init();
|
2021-02-22 21:52:38 +00:00
|
|
|
|
|
|
|
require Hydra::Schema;
|
|
|
|
require Hydra::Model::DB;
|
|
|
|
|
|
|
|
use Test2::V0;
|
|
|
|
|
|
|
|
my $db = Hydra::Model::DB->new;
|
|
|
|
hydra_setup($db);
|
|
|
|
|
|
|
|
my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
|
|
|
|
|
|
|
|
# Most basic test case, no parameters
|
2021-03-05 01:22:37 +00:00
|
|
|
my $jobset = createBaseJobset("basic", "basic.nix", $ctx{jobsdir});
|
2021-02-22 21:52:38 +00:00
|
|
|
|
|
|
|
ok(evalSucceeds($jobset), "Evaluating jobs/basic.nix should exit with return code 0");
|
|
|
|
is(nrQueuedBuildsForJobset($jobset), 3, "Evaluating jobs/basic.nix should result in 3 builds");
|
|
|
|
|
|
|
|
for my $build (queuedBuildsForJobset($jobset)) {
|
2021-06-16 15:48:49 +00:00
|
|
|
ok(runBuild($build), "Build '".$build->job."' from jobs/basic.nix should exit with return code 0");
|
2021-02-22 21:52:38 +00:00
|
|
|
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;
|
|
|
|
is($newbuild->buildstatus, $expected, "Build '".$build->job."' from jobs/basic.nix should have buildstatus $expected.");
|
|
|
|
}
|
|
|
|
|
2021-03-05 01:22:37 +00:00
|
|
|
done_testing;
|