Improve tests around constituents

- Test how shorter names are preferred when multiple jobs resolve to the
  same derivation.

- Test the exact aggregate map we get, by looking in the DB.
This commit is contained in:
John Ericson
2025-02-07 16:30:14 -05:00
parent 8d78648e65
commit 141b5fd0b5
3 changed files with 67 additions and 5 deletions

View File

@ -172,7 +172,6 @@ sub makeAndEvaluateJobset {
}
my $jobsdir = $opts{'jobsdir'} // $self->jobsdir;
my $should_build = $opts{'build'} // 0;
my %args = (
jobsdir => $jobsdir,
@ -184,12 +183,28 @@ sub makeAndEvaluateJobset {
$args{flake} = $flake;
}
my $jobsetCtx = $self->makeJobset(%args);
my $jobset = $jobsetCtx->{"jobset"};
return $self->evaluateJobset(
jobset => $jobsetCtx->{"jobset"},
expression => $expression,
flake => $flake,
build => $opts{"build"} // 0,
)
}
sub evaluateJobset {
my ($self, %opts) = @_;
my $jobset = $opts{'jobset'};
my $expression = $opts{'expression'} // $opts{'flake'};
evalSucceeds($jobset) or die "Evaluating jobs/$expression should exit with return code 0.\n";
my $builds = {};
my $should_build = $opts{'build'};
for my $build ($jobset->builds) {
if ($should_build) {
runBuild($build) or die "Build '".$build->job."' from jobs/$expression should exit with return code 0.\n";