test: Validate the source test manifests
This helps prevent testing against invalid manifest data. It runs on the source's manifest data, using the highest schema version parsed for the source.
This commit is contained in:
parent
e2345a6348
commit
0eb842e80c
1 changed files with 8 additions and 0 deletions
|
|
@ -127,6 +127,14 @@ def test_sources(source, case, tmp_path):
|
|||
items = desc.get("items", {})
|
||||
options = desc.get("options", {})
|
||||
|
||||
# What version to use for validation?
|
||||
version = "2" if info.opts["2"] else "1"
|
||||
schema = osbuild.meta.Schema(info.get_schema(version=version), source)
|
||||
res = schema.validate(desc)
|
||||
# NOTE: ValidationResult overrides __bool__ to return res.valid
|
||||
if not res:
|
||||
raise RuntimeError(f"Validation failed on {source}:{case}:{res.as_dict()}")
|
||||
|
||||
src = osbuild.sources.Source(info, items, options)
|
||||
|
||||
with osbuild.objectstore.ObjectStore(tmp_path) as store, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue