Skip to content

Commit

Permalink
treewide: start removing tests related to constituents
Browse files Browse the repository at this point in the history
The feature cannot easily be ported to nix-eval-jobs since it requires
deep integration into the evaluator, and h.n.o doesn't use it. Later
more of this will be ripped out.

(cherry picked from commit 370a4bf)
  • Loading branch information
delroth authored and Ericson2314 committed Nov 17, 2024
1 parent f2bcece commit d2227af
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 178 deletions.
35 changes: 0 additions & 35 deletions src/script/hydra-eval-jobset
Original file line number Diff line number Diff line change
Expand Up @@ -812,41 +812,6 @@ sub checkJobsetWrapped {
$ev->jobsetevalmembers->create({ build => $id, isnew => $x->{new} });
}

# Create AggregateConstituents mappings. Since there can
# be jobs that alias each other, if there are multiple
# builds for the same derivation, pick the one with the
# shortest name.
my %drvPathToId;
foreach my $id (keys %buildMap) {
my $x = $buildMap{$id};
my $y = $drvPathToId{$x->{drvPath}};
if (defined $y) {
next if length $x->{jobName} > length $y->{jobName};
next if length $x->{jobName} == length $y->{jobName} && $x->{jobName} ge $y->{jobName};
}
$drvPathToId{$x->{drvPath}} = $x;
}

# XXX: dead code with nix-eval-jobs. To be removed.
foreach my $job (values @jobs) {
next unless $job->{constituents};

if (defined $job->{error}) {
die "aggregate job ‘$job->{jobName}’ failed with the error: $job->{error}\n";
}

my $x = $drvPathToId{$job->{drvPath}} or
die "aggregate job ‘$job->{jobName}’ has no corresponding build record.\n";
foreach my $drvPath (@{$job->{constituents}}) {
my $constituent = $drvPathToId{$drvPath};
if (defined $constituent) {
$db->resultset('AggregateConstituents')->update_or_create({aggregate => $x->{id}, constituent => $constituent->{id}});
} else {
warn "aggregate job ‘$job->{jobName}’ has a constituent ‘$drvPath’ that doesn't correspond to a Hydra build\n";
}
}
}

foreach my $name (keys %{$inputInfo}) {
for (my $n = 0; $n < scalar(@{$inputInfo->{$name}}); $n++) {
my $input = $inputInfo->{$name}->[$n];
Expand Down
24 changes: 0 additions & 24 deletions t/Hydra/Controller/Build/api.t
Original file line number Diff line number Diff line change
Expand Up @@ -78,28 +78,4 @@ subtest "validating the JSON representation of a build" => sub {
}, "The build's JSON matches our API.");
};

subtest "accessing the constituents API" => sub {
my $url = $build_url . "/constituents";

my $constituents = request(GET $url,
Accept => 'application/json',
);

ok($constituents->is_success, "Getting the constituent builds");

my $data;
my $valid_json = lives { $data = decode_json($constituents->content); };
ok($valid_json, "We get back valid JSON.");
if (!$valid_json) {
use Data::Dumper;
print STDERR Dumper $constituents->content;
}

my ($buildA) = grep { $_->{nixname} eq "empty-dir-a" } @$data;
my ($buildB) = grep { $_->{nixname} eq "empty-dir-b" } @$data;

is($buildA->{job}, "a");
is($buildB->{job}, "b");
};

done_testing;
32 changes: 0 additions & 32 deletions t/evaluator/evaluate-constituents-broken.t

This file was deleted.

20 changes: 0 additions & 20 deletions t/evaluator/evaluate-constituents-gc.t

This file was deleted.

32 changes: 0 additions & 32 deletions t/queue-runner/constituents.t

This file was deleted.

35 changes: 0 additions & 35 deletions t/queue-runner/direct-indirect-constituents.t

This file was deleted.

0 comments on commit d2227af

Please sign in to comment.