Jobsets: update schema to align with the API
To further align with the API, we return custom JSON in order to display a `visible` field rather than `hidden` -- a `PUT` request expects `visible`, while a `GET` request returns `hidden`. This also allows us to rename the `jobsetinputs` field to `inputs` for the same reason: `PUT` expects `inputs`, while `GET` returns `jobsetinputs`.
This commit is contained in:
committed by
Graham Christensen
parent
d23f431889
commit
f1dd5d202e
@ -46,7 +46,7 @@ subtest 'Create new jobset "job" as flake type' => sub {
|
||||
Cookie => $cookie,
|
||||
Content => encode_json({
|
||||
enabled => 2,
|
||||
visible => 1,
|
||||
visible => JSON::true,
|
||||
name => "job",
|
||||
type => 1,
|
||||
description => "test jobset",
|
||||
@ -76,8 +76,8 @@ subtest 'Read newly-created jobset "job"' => sub {
|
||||
errormsg => "",
|
||||
fetcherrormsg => "",
|
||||
flake => "github:nixos/nix",
|
||||
hidden => JSON::false,
|
||||
jobsetinputs => {},
|
||||
visible => JSON::true,
|
||||
inputs => {},
|
||||
keepnr => 3,
|
||||
lastcheckedtime => undef,
|
||||
name => "job",
|
||||
@ -99,12 +99,12 @@ subtest 'Update jobset "job" to legacy type' => sub {
|
||||
Cookie => $cookie,
|
||||
Content => encode_json({
|
||||
enabled => 3,
|
||||
visible => 1,
|
||||
visible => JSON::true,
|
||||
name => "job",
|
||||
type => 0,
|
||||
nixexprinput => "ofborg",
|
||||
nixexprpath => "release.nix",
|
||||
jobsetinputs => {
|
||||
inputs => {
|
||||
ofborg => {
|
||||
name => "ofborg",
|
||||
type => "git",
|
||||
@ -134,15 +134,13 @@ subtest 'Update jobset "job" to legacy type' => sub {
|
||||
errormsg => "",
|
||||
fetcherrormsg => "",
|
||||
flake => "",
|
||||
hidden => JSON::false,
|
||||
jobsetinputs => {
|
||||
visible => JSON::true,
|
||||
inputs => {
|
||||
ofborg => {
|
||||
name => "ofborg",
|
||||
type => "git",
|
||||
emailresponsible => JSON::false,
|
||||
jobsetinputalts => [
|
||||
"https://github.com/NixOS/ofborg.git released"
|
||||
]
|
||||
value => "https://github.com/NixOS/ofborg.git released"
|
||||
}
|
||||
},
|
||||
keepnr => 1,
|
||||
|
@ -81,14 +81,14 @@ subtest "projects" => sub {
|
||||
};
|
||||
|
||||
subtest "jobsets" => sub {
|
||||
my $result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", jobsetinputs => { "my-src" => { type => "path", value => $jobsetdir } }, enabled => "1", visible => "1", checkinterval => "3600"} });
|
||||
my $result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", value => $jobsetdir } }, enabled => "1", visible => "1", checkinterval => "3600"} });
|
||||
is($result->code(), 201, "PUTting a new jobset creates it");
|
||||
|
||||
my $jobset = decode_json(request_json({ uri => '/jobset/sample/default' })->content());
|
||||
|
||||
ok(exists $jobset->{jobsetinputs}->{"my-src"}, "The new jobset has a 'my-src' input");
|
||||
ok(exists $jobset->{inputs}->{"my-src"}, "The new jobset has a 'my-src' input");
|
||||
|
||||
is($jobset->{jobsetinputs}->{"my-src"}->{"jobsetinputalts"}->[0], $jobsetdir, "The 'my-src' input is in $jobsetdir");
|
||||
is($jobset->{inputs}->{"my-src"}->{value}, $jobsetdir, "The 'my-src' input is in $jobsetdir");
|
||||
};
|
||||
|
||||
subtest "evaluation" => sub {
|
||||
|
Reference in New Issue
Block a user