Cleanup build serialization

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-10-24 15:47:36 -04:00
parent e04477003e
commit 5d3df69a0b
3 changed files with 14 additions and 26 deletions

View file

@ -98,23 +98,7 @@ sub build_GET {
{ rows => 1, order_by => ["id"] })->single; { rows => 1, order_by => ["id"] })->single;
$self->status_ok( $self->status_ok(
$c, $c,
entity => $c->model('DB::Builds')->find($build->id,{ entity => $build
columns => [
'id',
'finished',
'timestamp',
'buildstatus',
'job',
'project',
'jobset',
'starttime',
'stoptime',
'nixname',
'description',
'drvpath',
'system',
]
})
); );
# If this is an aggregate build, get its constituents. # If this is an aggregate build, get its constituents.

View file

@ -601,4 +601,15 @@ makeQueries('ForJobset', "and project = ? and jobset = ?");
makeQueries('ForJob', "and project = ? and jobset = ? and job = ?"); makeQueries('ForJob', "and project = ? and jobset = ? and job = ?");
my %hint = (
columns => [
"job",
"finished"
]
);
sub json_hint {
return \%hint;
}
1; 1;

View file

@ -1,7 +1,6 @@
use LWP::UserAgent; use LWP::UserAgent;
use JSON; use JSON;
use Test::Simple tests => 13; use Test::Simple tests => 15;
#use Test::Simple tests => 15;
my $ua = LWP::UserAgent->new; my $ua = LWP::UserAgent->new;
$ua->cookie_jar({}); $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}; 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"); 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]->{eval}->{builds}->[0] })->content());
my $build = decode_json(request_json({ uri => "/build/" . $evals->[0]->{jobsetevalmembers}->[0]->{build} })->content());
ok($build->{job} eq "job", "The build's job name is job"); ok($build->{job} eq "job", "The build's job name is job");
ok($build->{finished} == 0, "The build isn't finished yet"); ok($build->{finished} == 0, "The build isn't finished yet");
=end comment
=cut