input-types: use is() for test comparisons

This commit is contained in:
Graham Christensen 2021-02-23 14:52:37 -05:00
parent 371826f931
commit 611d7b71f2
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -83,34 +83,37 @@ my @scminputs = (
foreach my $scm ( @scminputs ) { foreach my $scm ( @scminputs ) {
my $scmName = $scm->{"name"}; my $scmName = $scm->{"name"};
my $nixexpr = $scm->{"nixexpr"};
my $type = $scm->{"type"};
my $uri = $scm->{"uri"};
my $update = $scm->{"update"};
my $jobset = createJobsetWithOneInput($scmName, $nixexpr, "src", $type, $uri);
my $state = 0; subtest "With the SCM input named $scmName" => sub {
my $q = 0; my $nixexpr = $scm->{"nixexpr"};
my ($loop, $updated) = updateRepository($scmName, $update); my $type = $scm->{"type"};
while($loop) { my $uri = $scm->{"uri"};
my $c = 0; my $update = $scm->{"update"};
my $jobset = createJobsetWithOneInput($scmName, $nixexpr, "src", $type, $uri);
# Verify that it can be fetched and possibly queued. my $state = 0;
ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression."); $c++; my $q = 0;
my ($loop, $updated) = updateRepository($scmName, $update);
while($loop) {
subtest "Mutation number $state" => sub {
# Verify that it can be fetched and possibly queued.
ok(evalSucceeds($jobset), "Evaluating nix-expression.");
# Verify that the evaluation has queued a new job and evaluate again to ... # Verify that the evaluation has queued a new job and evaluate again to ...
if ($updated) { if ($updated) {
$q++; $q++;
ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++; is(nrQueuedBuildsForJobset($jobset), $q, "Expect $q jobs in the queue.");
ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression again."); $c++; ok(evalSucceeds($jobset), "Evaluating nix-expression again.");
}
# ... check that it is deterministic and not queued again.
is(nrQueuedBuildsForJobset($jobset), $q, "Expect deterministic evaluation.");
$state++;
($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
};
} }
};
# ... check that it is deterministic and not queued again.
ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
$state++;
($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
}
} }
done_testing; done_testing;