test/fmt_v1: check result is complete
In the output test, check that for a successful pipeline run all the elements are present: main result, assembler result, stage result. NB: Build result is hard to test because we would need to actually build a valid build root.
This commit is contained in:
parent
74e6302860
commit
eb6461c165
1 changed files with 34 additions and 0 deletions
|
|
@ -187,6 +187,7 @@ class TestFormatV1(unittest.TestCase):
|
|||
self.assertEqual(info.version, "1")
|
||||
self.assertEqual(info.module, fmt)
|
||||
|
||||
#pylint: disable=too-many-statements
|
||||
@unittest.skipUnless(test.TestBase.can_bind_mount(), "root-only")
|
||||
def test_format_output(self):
|
||||
"""Test that output formatting is as expected"""
|
||||
|
|
@ -291,6 +292,39 @@ class TestFormatV1(unittest.TestCase):
|
|||
self.assertIn("success", result)
|
||||
self.assertFalse(result["success"], result)
|
||||
|
||||
# check we get all the output nodes for a successful build
|
||||
description = {
|
||||
"pipeline": {
|
||||
"stages": [
|
||||
{
|
||||
"name": "org.osbuild.noop"
|
||||
},
|
||||
],
|
||||
"assembler": {
|
||||
"name": "org.osbuild.noop"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
manifest = fmt.load(description, index)
|
||||
self.assertIsNotNone(manifest)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
res = self.build_manifest(manifest, tmpdir)
|
||||
|
||||
self.assertIsNotNone(res)
|
||||
result = fmt.output(manifest, res)
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
self.assertIn("stages", result)
|
||||
for stage in result["stages"]:
|
||||
self.assertIn("success", stage)
|
||||
self.assertTrue(stage["success"])
|
||||
|
||||
self.assertIn("assembler", result)
|
||||
self.assertIn("success", result["assembler"])
|
||||
self.assertTrue(result["assembler"]["success"])
|
||||
|
||||
def test_validation(self):
|
||||
index = osbuild.meta.Index(os.curdir)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue