diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 068a0ccc..44182bfc 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -98,23 +98,7 @@ sub build_GET { { rows => 1, order_by => ["id"] })->single; $self->status_ok( $c, - entity => $c->model('DB::Builds')->find($build->id,{ - columns => [ - 'id', - 'finished', - 'timestamp', - 'buildstatus', - 'job', - 'project', - 'jobset', - 'starttime', - 'stoptime', - 'nixname', - 'description', - 'drvpath', - 'system', - ] - }) + entity => $build ); # If this is an aggregate build, get its constituents. diff --git a/src/lib/Hydra/Schema/Builds.pm b/src/lib/Hydra/Schema/Builds.pm index 59b06d77..d7337697 100644 --- a/src/lib/Hydra/Schema/Builds.pm +++ b/src/lib/Hydra/Schema/Builds.pm @@ -601,4 +601,15 @@ makeQueries('ForJobset', "and project = ? and jobset = ?"); makeQueries('ForJob', "and project = ? and jobset = ? and job = ?"); +my %hint = ( + columns => [ + "job", + "finished" + ] +); + +sub json_hint { + return \%hint; +} + 1; diff --git a/tests/api-test.pl b/tests/api-test.pl index 68b28d3d..4e3b5311 100644 --- a/tests/api-test.pl +++ b/tests/api-test.pl @@ -1,7 +1,6 @@ use LWP::UserAgent; use JSON; -use Test::Simple tests => 13; -#use Test::Simple tests => 15; +use Test::Simple tests => 15; my $ua = LWP::UserAgent->new; $ua->cookie_jar({}); @@ -60,12 +59,6 @@ system("echo >> /run/jobset/default.nix; LOGNAME=root NIX_STORE_DIR=/run/nix/sto my $evals = decode_json(request_json({ uri => '/jobset/sample/default/evals' })->content())->{evals}; ok($evals->[0]->{eval}->{jobsetevalinputs}->{"my-src"}->{revision} != $evals->[1]->{eval}->{jobsetevalinputs}->{"my-src"}->{revision}, "Changing a jobset source changes its revision"); -=begin comment - -my $build = decode_json(request_json({ uri => "/build/" . $evals->[0]->{jobsetevalmembers}->[0]->{build} })->content()); +my $build = decode_json(request_json({ uri => "/build/" . $evals->[0]->{eval}->{builds}->[0] })->content()); ok($build->{job} eq "job", "The build's job name is job"); ok($build->{finished} == 0, "The build isn't finished yet"); - -=end comment - -=cut