@@ -31,7 +31,13 @@ func TestConfig(t *testing.T) {
3131 config : `
3232{
3333 "architecture": "amd64",
34- "os": 123
34+ "os": 123,
35+ "rootfs": {
36+ "diff_ids": [
37+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
38+ ],
39+ "type": "layers"
40+ }
3541}
3642` ,
3743 fail : true ,
@@ -47,6 +53,12 @@ func TestConfig(t *testing.T) {
4753 "os": "linux",
4854 "config": {
4955 "User": 1234
56+ },
57+ "rootfs": {
58+ "diff_ids": [
59+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
60+ ],
61+ "type": "layers"
5062 }
5163}
5264` ,
@@ -57,7 +69,15 @@ func TestConfig(t *testing.T) {
5769 {
5870 config : `
5971{
60- "history": "should be an array"
72+ "history": "should be an array",
73+ "architecture": "amd64",
74+ "os": 123,
75+ "rootfs": {
76+ "diff_ids": [
77+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
78+ ],
79+ "type": "layers"
80+ }
6181}
6282` ,
6383 fail : true ,
@@ -67,10 +87,18 @@ func TestConfig(t *testing.T) {
6787 {
6888 config : `
6989{
90+ "architecture": "amd64",
91+ "os": 123,
7092 "config": {
7193 "Env": [
7294 7353
7395 ]
96+ },
97+ "rootfs": {
98+ "diff_ids": [
99+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
100+ ],
101+ "type": "layers"
74102 }
75103}
76104` ,
@@ -81,11 +109,19 @@ func TestConfig(t *testing.T) {
81109 {
82110 config : `
83111{
112+ "architecture": "amd64",
113+ "os": 123,
84114 "config": {
85115 "Volumes": [
86116 "/var/job-result-data",
87117 "/var/log/my-app-logs"
88118 ]
119+ },
120+ "rootfs": {
121+ "diff_ids": [
122+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
123+ ],
124+ "type": "layers"
89125 }
90126}
91127` ,
@@ -98,6 +134,7 @@ func TestConfig(t *testing.T) {
98134 fail : true ,
99135 },
100136
137+ // valid config with optional fields
101138 {
102139 config : `
103140{
@@ -151,6 +188,23 @@ func TestConfig(t *testing.T) {
151188 }
152189 ]
153190}
191+ ` ,
192+ fail : false ,
193+ },
194+
195+ // valid config with only required fields
196+ {
197+ config : `
198+ {
199+ "architecture": "amd64",
200+ "os": "linux",
201+ "rootfs": {
202+ "diff_ids": [
203+ "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
204+ ],
205+ "type": "layers"
206+ }
207+ }
154208` ,
155209 fail : false ,
156210 },
0 commit comments