Skip to content

Commit a99d5e7

Browse files
author
Alan Christie
committed
feat: Adds test-groups and run-groups
1 parent e6cd329 commit a99d5e7

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

decoder/job-definition-schema.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ properties:
3030
pattern: '^[a-z]{1}[a-z0-9-]*$'
3131
jobs:
3232
$ref: '#/definitions/job-identity'
33+
test-groups:
34+
$ref: '#/definitions/test-groups'
3335
required:
3436
- kind
3537
- kind-version
@@ -323,6 +325,26 @@ definitions:
323325
maxLength: 63
324326
pattern: '^[a-z]([a-z0-9-]*[a-z0-9])?$'
325327

328+
# Test groups.
329+
# A list of groups that have a name and optional compose-file.
330+
test-groups:
331+
type: array
332+
items:
333+
type: object
334+
additionalProperties: false
335+
properties:
336+
name:
337+
type: string
338+
minLength: 1
339+
maxLength: 63
340+
pattern: '^[a-z]{1}[a-z0-9-]*$'
341+
compose-file:
342+
type: string
343+
pattern: '^docker-compose(-[a-z0-9-]{1,})?.yaml$'
344+
required:
345+
- name
346+
additionalProperties: false
347+
326348
# An individual Test.
327349
# Consists of a identity (i.e. 'test-filter-molecules')
328350
# followed by a Test object.
@@ -346,6 +368,10 @@ definitions:
346368
type: object
347369
additionalProperties: false
348370
properties:
371+
run-groups:
372+
type: array
373+
items:
374+
$ref: '#/definitions/run-group'
349375
run-level:
350376
type: integer
351377
minimum: 1
@@ -375,6 +401,21 @@ definitions:
375401
required:
376402
- exitCode
377403

404+
run-group:
405+
type: object
406+
additionalProperties: false
407+
properties:
408+
name:
409+
type: string
410+
minLength: 1
411+
maxLength: 63
412+
pattern: '^[a-z]{1}[a-z0-9-]*$'
413+
ordinal:
414+
type: integer
415+
minimum: 1
416+
required:
417+
- name
418+
378419
# A test input, a string or array of strings
379420
test-input:
380421
type: object

tests/test_validate_job_schema.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,46 @@ def test_validate_test_option_array():
223223

224224
# Assert
225225
assert error is None
226+
227+
228+
def test_validate_test_groups():
229+
# Arrange
230+
text: Dict[str, Any] = deepcopy(_MINIMAL)
231+
text["test-groups"] = [{"name": "demo-1"}, {"name": "demo-2"}]
232+
233+
# Act
234+
error = decoder.validate_job_schema(text)
235+
236+
# Assert
237+
assert error is None
238+
239+
240+
def test_validate_test_groups_with_compose():
241+
# Arrange
242+
text: Dict[str, Any] = deepcopy(_MINIMAL)
243+
text["test-groups"] = [
244+
{"name": "demo-1", "compose-file": "docker-compose-abc.yaml"}
245+
]
246+
247+
# Act
248+
error = decoder.validate_job_schema(text)
249+
250+
# Assert
251+
assert error is None
252+
253+
254+
def test_validate_test_run_groups():
255+
# Arrange
256+
text: Dict[str, Any] = deepcopy(_MINIMAL)
257+
demo_job: Dict[str, Any] = text["jobs"]["demo"]
258+
demo_job["tests"] = {
259+
"basic-1": {
260+
"run-groups": [{"name": "demo-1"}, {"name": "demo-2", "ordinal": 1}],
261+
},
262+
}
263+
264+
# Act
265+
error = decoder.validate_job_schema(text)
266+
267+
# Assert
268+
assert error is None

0 commit comments

Comments
 (0)