2011-03-16 13:18:12 +00:00
|
|
|
use strict;
|
2021-08-19 20:36:43 +00:00
|
|
|
use warnings;
|
2011-03-16 13:18:12 +00:00
|
|
|
use Setup;
|
|
|
|
|
2021-02-26 00:26:38 +00:00
|
|
|
my %ctx = test_init();
|
2021-02-22 18:47:41 +00:00
|
|
|
|
|
|
|
require Hydra::Schema;
|
|
|
|
require Hydra::Model::DB;
|
2011-03-16 13:18:12 +00:00
|
|
|
|
2021-02-23 19:28:57 +00:00
|
|
|
use Test2::V0;
|
2011-03-16 13:18:12 +00:00
|
|
|
|
2021-02-22 18:47:41 +00:00
|
|
|
my $db = Hydra::Model::DB->new;
|
2011-03-16 13:18:12 +00:00
|
|
|
hydra_setup($db);
|
|
|
|
|
2011-03-17 08:48:27 +00:00
|
|
|
|
2013-03-20 17:05:21 +00:00
|
|
|
# Test build products
|
|
|
|
|
2021-03-05 01:22:37 +00:00
|
|
|
my $jobset = createBaseJobset("build-products", "build-products.nix", $ctx{jobsdir});
|
2013-03-20 17:05:21 +00:00
|
|
|
|
2021-02-23 19:44:23 +00:00
|
|
|
ok(evalSucceeds($jobset), "Evaluating jobs/build-products.nix should exit with return code 0");
|
|
|
|
is(nrQueuedBuildsForJobset($jobset), 2, "Evaluating jobs/build-products.nix should result in 2 builds");
|
2013-03-20 17:05:21 +00:00
|
|
|
|
|
|
|
for my $build (queuedBuildsForJobset($jobset)) {
|
2021-02-23 19:44:23 +00:00
|
|
|
subtest "For the build job '" . $build->job . "'" => sub {
|
2021-06-16 15:48:49 +00:00
|
|
|
ok(runBuild($build), "Build should exit with return code 0");
|
2021-02-23 19:44:23 +00:00
|
|
|
my $newbuild = $db->resultset('Builds')->find($build->id);
|
|
|
|
|
|
|
|
is($newbuild->finished, 1, "Build should have finished");
|
|
|
|
is($newbuild->buildstatus, 0, "Build should have buildstatus 0");
|
|
|
|
|
|
|
|
my $buildproducts = $db->resultset('BuildProducts')->search({ build => $build->id });
|
|
|
|
my $buildproduct = $buildproducts->next;
|
|
|
|
|
|
|
|
if($build->job eq "simple") {
|
|
|
|
is($buildproduct->name, "text.txt", "We should have \"text.txt\"");
|
|
|
|
} elsif ($build->job eq "with_spaces") {
|
|
|
|
is($buildproduct->name, "some text.txt", "We should have: \"some text.txt\"");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-03-20 17:05:21 +00:00
|
|
|
}
|
2021-02-23 19:28:57 +00:00
|
|
|
|
|
|
|
done_testing;
|