Skip to content

Commit ab270ed

Browse files
Jeny Sadadianuclearcat
Jeny Sadadia
authored andcommitted
tests/validate_yaml: add validation for KCIDB mapping
To submit KernelCI generated data to KCIDB, it is required to have a mapping for all the job definition with `kcidb_test_suite` property. Add validation to ensure all the jobs have a mapping present to avoid missing data submission. This check is to notify test authors trying to enable tests in maestro to include the required property for the mapping in their definition. Signed-off-by: Jeny Sadadia <[email protected]>
1 parent ba68789 commit ab270ed

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/validate_yaml.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@ def validate_yaml():
1515
if file.endswith('.yaml'):
1616
with open('config/' + file, 'r') as stream:
1717
try:
18-
yaml.safe_load(stream)
18+
data = yaml.safe_load(stream)
19+
jobs = data.get('jobs')
20+
if not jobs:
21+
continue
22+
for name, definition in jobs.items():
23+
if definition.get('kind') in ("test", "job"):
24+
if not definition.get('kcidb_test_suite'):
25+
raise yaml.YAMLError(
26+
f"KCIDB test suite mapping not found for job: {name}'"
27+
)
1928
except yaml.YAMLError as exc:
2029
print(f'Error in {file}: {exc}')
2130
sys.exit(1)
2231

2332
if __name__ == '__main__':
24-
validate_yaml()
33+
validate_yaml()

0 commit comments

Comments
 (0)