Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions schema/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ func TestConfig(t *testing.T) {
config: `
{
"architecture": "amd64",
"os": 123
"os": 123,
"rootfs": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one (and a few others) is still missing architecture and os.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wking

This one (and a few others) is still missing architecture and os.

Excuse me I might not understand your comment. architecture and os seems have been added to all cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I'm just blind. ceb8cf8 looks good to me.

"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
fail: true,
Expand All @@ -47,6 +53,12 @@ func TestConfig(t *testing.T) {
"os": "linux",
"config": {
"User": 1234
},
"rootfs": {
"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
Expand All @@ -57,7 +69,15 @@ func TestConfig(t *testing.T) {
{
config: `
{
"history": "should be an array"
"history": "should be an array",
"architecture": "amd64",
"os": 123,
"rootfs": {
"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
fail: true,
Expand All @@ -67,10 +87,18 @@ func TestConfig(t *testing.T) {
{
config: `
{
"architecture": "amd64",
"os": 123,
"config": {
"Env": [
7353
]
},
"rootfs": {
"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
Expand All @@ -81,11 +109,19 @@ func TestConfig(t *testing.T) {
{
config: `
{
"architecture": "amd64",
"os": 123,
"config": {
"Volumes": [
"/var/job-result-data",
"/var/log/my-app-logs"
]
},
"rootfs": {
"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
Expand All @@ -98,6 +134,7 @@ func TestConfig(t *testing.T) {
fail: true,
},

// valid config with optional fields
{
config: `
{
Expand Down Expand Up @@ -151,6 +188,23 @@ func TestConfig(t *testing.T) {
}
]
}
`,
fail: false,
},

// valid config with only required fields
{
config: `
{
"architecture": "amd64",
"os": "linux",
"rootfs": {
"diff_ids": [
"sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
],
"type": "layers"
}
}
`,
fail: false,
},
Expand Down