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:
Cole Helbling
2021-04-28 12:41:05 -07:00
committed by Graham Christensen
parent d23f431889
commit f1dd5d202e
6 changed files with 58 additions and 60 deletions

View File

@ -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,