Cleanup Jobset serialization

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-10-24 11:01:17 -04:00
parent 78dcd3e619
commit 04d8adaad3
2 changed files with 15 additions and 4 deletions

View file

@ -308,4 +308,14 @@ __PACKAGE__->has_many(
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29 # Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-10-14 15:46:29
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DTAGxP5RFvcNxP/ciJGo4Q # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:DTAGxP5RFvcNxP/ciJGo4Q
my %hint = (
relations => {
jobsetinputs => "name"
}
);
sub json_hint {
return \%hint;
}
1; 1;

View file

@ -1,6 +1,6 @@
use LWP::UserAgent; use LWP::UserAgent;
use JSON; use JSON;
use Test::Simple tests => 7; use Test::Simple tests => 9;
#use Test::Simple tests => 15; #use Test::Simple tests => 15;
my $ua = LWP::UserAgent->new; my $ua = LWP::UserAgent->new;
@ -38,14 +38,15 @@ my $project = decode_json(request_json({ uri => '/project/sample' })->content())
ok((not @{$project->{jobsets}}), "A new project has no jobsets"); ok((not @{$project->{jobsets}}), "A new project has no jobsets");
=begin comment
$result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", values => "/run/jobset" } }, enabled => "1", checkinterval => "3600"} }); $result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", values => "/run/jobset" } }, enabled => "1", checkinterval => "3600"} });
ok($result->code() == 201, "PUTting a new jobset creates it"); ok($result->code() == 201, "PUTting a new jobset creates it");
my $jobset = decode_json(request_json({ uri => '/jobset/sample/default' })->content()); my $jobset = decode_json(request_json({ uri => '/jobset/sample/default' })->content());
ok($jobset->{jobsetinputs}->[0]->{name} eq "my-src", "The new jobset has a 'my-src' input"); ok($jobset->{jobsetinputs}->[0] eq "my-src", "The new jobset has a 'my-src' input");
=begin comment
ok($jobset->{jobsetinputs}->[0]->{jobsetinputalts}->[0]->{value} eq "/run/jobset", "The 'my-src' input is in /run/jobset"); ok($jobset->{jobsetinputs}->[0]->{jobsetinputalts}->[0]->{value} eq "/run/jobset", "The 'my-src' input is in /run/jobset");
system("LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default"); system("LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default");