Skip to content

Commit

Permalink
tests/validate_yaml: add validation for KCIDB mapping
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Jeny Sadadia authored and nuclearcat committed Jun 14, 2024
1 parent ba68789 commit ab270ed
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/validate_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ def validate_yaml():
if file.endswith('.yaml'):
with open('config/' + file, 'r') as stream:
try:
yaml.safe_load(stream)
data = yaml.safe_load(stream)
jobs = data.get('jobs')
if not jobs:
continue
for name, definition in jobs.items():
if definition.get('kind') in ("test", "job"):
if not definition.get('kcidb_test_suite'):
raise yaml.YAMLError(
f"KCIDB test suite mapping not found for job: {name}'"
)
except yaml.YAMLError as exc:
print(f'Error in {file}: {exc}')
sys.exit(1)

if __name__ == '__main__':
validate_yaml()
validate_yaml()

0 comments on commit ab270ed

Please sign in to comment.