test/osbuild: also validate the schema of stages

Up until now it was verified that loading the `STAGE_OPTS` data
works, i.e. that it contains valid JSON, but the schema itself
was not verified. Use the new `Schema.check` method to do that.
This commit is contained in:
Christian Kellner 2020-04-29 15:49:13 +02:00
parent 9d08f4faf2
commit 26ca79ec25

View file

@ -87,7 +87,12 @@ class TestDescriptions(unittest.TestCase):
for stage in stages:
klass, name = stage
try:
osbuild.meta.StageInfo.load(os.curdir, klass, name)
info = osbuild.meta.StageInfo.load(os.curdir, klass, name)
schema = osbuild.meta.Schema(info.schema, name)
res = schema.check()
if not res:
err = "\n ".join(str(e) for e in res)
self.fail(str(res) + "\n " + err)
except json.decoder.JSONDecodeError as e:
msg = f"{klass} '{name}' has invalid STAGE_OPTS\n\t" + str(e)
self.fail(msg)