forked from SchemaStore/schemastore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainer-structure-test.json
345 lines (345 loc) · 10.2 KB
/
container-structure-test.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Container Structure Tests",
"description": "The Container Structure Tests provide a powerful framework to validate the structure of a container image. These tests can be used to check the output of commands in an image, as well as verify metadata and contents of the filesystem",
"$comment": "https://github.com/GoogleContainerTools/container-structure-test",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion"
],
"properties": {
"schemaVersion": {
"type": "string",
"description": "The schema version of Structure Tests.",
"default": "2.0.0"
},
"commandTests": {
"type": "array",
"description": "A list of command tests",
"items": {
"type": "object",
"required": [
"name",
"command"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the test"
},
"setup": {
"type": "array",
"description": "A list of commands (each with optional flags) to run before the actual command under test.",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
},
"teardown": {
"type": "array",
"description": "A list of commands (each with optional flags) to run after the actual command under test.",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
},
"envVars": {
"type": "array",
"items": {
"$ref": "#/definitions/envVar"
}
},
"command": {
"type": "string",
"description": "The command to run in the test."
},
"args": {
"type": "array",
"description": "The arguments to pass to the command.",
"items": {
"type": "string"
}
},
"expectedOutput": {
"type": "array",
"description": "List of regexes that should match the stdout from running the command.",
"minItems": 1,
"items": {
"type": "string"
}
},
"excludedOutput": {
"type": "array",
"description": "List of regexes that should not match the stdout from running the command..",
"minItems": 1,
"items": {
"type": "string"
}
},
"expectedError": {
"type": "array",
"description": "List of regexes that should match the stderr from running the command.",
"minItems": 1,
"items": {
"type": "string"
}
},
"excludedError": {
"type": "array",
"description": "List of regexes that should not match the stderr from running the command.",
"minItems": 1,
"items": {
"type": "string"
}
},
"exitCode": {
"type": "integer",
"description": "Exit code that the command should exit with."
}
}
}
},
"fileExistenceTests": {
"type": "array",
"description": "File existence tests check to make sure a specific file (or directory) exist within the file system of the image. No contents of the files or directories are checked. These tests can also be used to ensure a file or directory is not present in the file system.",
"items": {
"type": "object",
"required": [
"name",
"path",
"shouldExist"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the test"
},
"path": {
"type": "string",
"description": "Path to the file or directory under test",
"default": "/"
},
"shouldExist": {
"type": "boolean",
"description": "Whether or not the specified file or directory should exist in the file system",
"default": true
},
"permissions": {
"type": "string",
"description": "The expected Unix permission string (e.g. drwxrwxrwx) of the files or directory."
},
"uid": {
"type": "number",
"description": "The expected Unix user ID of the owner of the file or directory."
},
"gid": {
"type": "number",
"description": "The expected Unix group ID of the owner of the file or directory."
},
"isExecutableBy": {
"type": "string",
"description": "Checks if file is executable by a given user. ",
"enum": [
"owner",
"group",
"any",
"other"
]
}
}
}
},
"fileContentTests": {
"description": "File content tests open a file on the file system and check its contents. These tests assume the specified file is a file, and that it exists",
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"path"
],
"properties": {
"name": {
"type": "string",
"description": "The name of the test"
},
"path": {
"type": "string",
"description": "Path to the file under test"
},
"expectedContents": {
"type": "array",
"description": "List of regexes that should match the contents of the file",
"minItems": 1,
"items": {
"type": "string"
}
},
"excludedContents": {
"type": "array",
"description": "List of regexes that should not match the contents of the file",
"minItems": 1,
"items": {
"type": "string"
}
}
}
}
},
"licenseTests": {
"description": "License tests check a list of copyright files and makes sure all licenses are allowed at Google. By default it will look at where Debian lists all copyright files, but can also look at an arbitrary list of files.",
"type": "array",
"items": {
"type": "object",
"required": [
"debian"
],
"properties": {
"debian": {
"type": "boolean",
"default": true,
"description": "if the image is based on Debian, check where Debian lists all licenses."
},
"files": {
"type": "array",
"description": "A list of other files to check.",
"minItems": 1,
"items": {
"type": "string"
}
}
}
}
},
"metadataTest": {
"type": "object",
"properties": {
"env": {
"type": "array",
"description": "A list of environment variable key/value pairs that should be set in the container.",
"minItems": 1,
"items": {
"$ref": "#/definitions/envVar"
}
},
"labels": {
"type": "array",
"description": "A list of image labels key/value pairs that should be set on the container.",
"minItems": 1,
"items": {
"$ref": "#/definitions/label"
}
},
"entrypoint": {
"type": "array",
"description": "The entrypoint of the container",
"minItems": 1,
"items": {
"type": "string"
}
},
"cmd": {
"type": "array",
"description": "The CMD specified in the container",
"minItems": 1,
"items": {
"type": "string"
}
},
"exposedPorts": {
"type": "array",
"description": "The ports exposed in the container.",
"minItems": 1,
"items": {
"type": "string"
}
},
"unexposedPorts": {
"type": "array",
"description": "The ports NOT exposed in the container.",
"minItems": 1,
"items": {
"type": "string"
}
},
"volumes": {
"type": "array",
"description": "The volumes exposed in the container.",
"minItems": 1,
"items": {
"type": "string"
}
},
"unmountedVolumes": {
"type": "array",
"description": "The volumes NOT exposed in the container",
"minItems": 1,
"items": {
"type": "string"
}
},
"workdir": {
"type": "string",
"description": "The default working directory of the container."
}
}
},
"globalEnvVars": {
"type": "array",
"description": "A list of environment variables can optionally be specified as part of the test setup. ",
"minItems": 1,
"items": {
"$ref": "#/definitions/envVar"
}
}
},
"definitions": {
"envVar": {
"$id": "#/definitions/envVar",
"type": "object",
"additionalProperties": false,
"required": [
"key",
"value"
],
"properties": {
"key": {
"type": "string",
"description": "The name of the environment variables"
},
"value": {
"type": "string",
"description": "The value of the environment variable"
}
}
},
"label": {
"$id": "#/definitions/label",
"type": "object",
"additionalProperties": false,
"required": [
"key",
"value"
],
"properties": {
"key": {
"type": "string",
"description": "The name of the label"
},
"value": {
"type": "string",
"description": "The value of the label"
},
"isRegex": {
"type": "boolean",
"description": "Interpreted the value as regex"
}
}
}
}
}