2022-02-20 16:54:14 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Setup;
|
|
|
|
use Test2::V0;
|
|
|
|
|
|
|
|
my $ctx = test_context();
|
|
|
|
|
|
|
|
my $builds = $ctx->makeAndEvaluateJobset(
|
|
|
|
expression => 'constituents.nix',
|
|
|
|
);
|
|
|
|
|
|
|
|
my $constituentBuildA = $builds->{"constituentA"};
|
|
|
|
my $constituentBuildB = $builds->{"constituentB"};
|
|
|
|
|
|
|
|
my $eval = $constituentBuildA->jobsetevals->first();
|
2024-04-12 15:33:27 +00:00
|
|
|
is($eval->evaluationerror->has_error, 0);
|
2022-02-20 16:54:14 +00:00
|
|
|
|
|
|
|
subtest "Verifying the direct aggregate" => sub {
|
|
|
|
my $aggBuild = $builds->{"direct_aggregate"};
|
|
|
|
is($aggBuild->constituents->first()->id, $constituentBuildA->id, "The ID of the constituent is correct");
|
|
|
|
};
|
|
|
|
|
|
|
|
subtest "Verifying the indirect aggregate" => sub {
|
|
|
|
my $indirectBuild = $builds->{"indirect_aggregate"};
|
|
|
|
is($indirectBuild->constituents->first()->id, $constituentBuildA->id, "The ID of the constituent is correct");
|
|
|
|
};
|
|
|
|
|
|
|
|
subtest "Verifying a mix of direct and indirect aggregate references" => sub {
|
|
|
|
my $mixedBuild = $builds->{"mixed_aggregate"};
|
|
|
|
my ($constituentA, $constituentB) = $mixedBuild->constituents()->search({}, {order_by => { -asc => "job"} });
|
|
|
|
is($constituentA->id, $constituentBuildA->id, "The ID of the constituent is correct");
|
|
|
|
is($constituentB->id, $constituentBuildB->id, "The ID of the constituent is correct");
|
|
|
|
};
|
|
|
|
|
|
|
|
done_testing;
|