forked from lix-project/hydra
build-products: switch to makeAndEvaluateJobset
This commit is contained in:
parent
7333d444c6
commit
008321d972
|
@ -1,43 +1,36 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Setup;
|
use Setup;
|
||||||
|
|
||||||
my %ctx = test_init();
|
|
||||||
|
|
||||||
require Hydra::Schema;
|
|
||||||
require Hydra::Model::DB;
|
|
||||||
|
|
||||||
use Test2::V0;
|
use Test2::V0;
|
||||||
|
|
||||||
my $db = Hydra::Model::DB->new;
|
my $ctx = test_context();
|
||||||
hydra_setup($db);
|
|
||||||
|
|
||||||
|
|
||||||
# Test build products
|
# Test build products
|
||||||
|
|
||||||
my $jobset = createBaseJobset("build-products", "build-products.nix", $ctx{jobsdir});
|
my $builds = $ctx->makeAndEvaluateJobset(
|
||||||
|
expression => "build-products.nix",
|
||||||
|
build => 1
|
||||||
|
);
|
||||||
|
|
||||||
ok(evalSucceeds($jobset), "Evaluating jobs/build-products.nix should exit with return code 0");
|
subtest "For the build job 'simple'" => sub {
|
||||||
is(nrQueuedBuildsForJobset($jobset), 2, "Evaluating jobs/build-products.nix should result in 2 builds");
|
my $build = $builds->{"simple"};
|
||||||
|
|
||||||
for my $build (queuedBuildsForJobset($jobset)) {
|
is($build->finished, 1, "Build should have finished");
|
||||||
subtest "For the build job '" . $build->job . "'" => sub {
|
is($build->buildstatus, 0, "Build should have buildstatus 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");
|
my $buildproduct = $build->buildproducts->next;
|
||||||
is($newbuild->buildstatus, 0, "Build should have buildstatus 0");
|
is($buildproduct->name, "text.txt", "We should have \"text.txt\"");
|
||||||
|
};
|
||||||
|
|
||||||
my $buildproducts = $db->resultset('BuildProducts')->search({ build => $build->id });
|
subtest "For the build job 'with_spaces'" => sub {
|
||||||
my $buildproduct = $buildproducts->next;
|
my $build = $builds->{"with_spaces"};
|
||||||
|
|
||||||
if($build->job eq "simple") {
|
is($build->finished, 1, "Build should have finished");
|
||||||
is($buildproduct->name, "text.txt", "We should have \"text.txt\"");
|
is($build->buildstatus, 0, "Build should have buildstatus 0");
|
||||||
} elsif ($build->job eq "with_spaces") {
|
|
||||||
is($buildproduct->name, "some text.txt", "We should have: \"some text.txt\"");
|
my $buildproduct = $build->buildproducts->next;
|
||||||
}
|
is($buildproduct->name, "some text.txt", "We should have: \"some text.txt\"");
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in a new issue