From 4a7efa087e7a519080b6041e7c62715ac199e215 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 19 Feb 2021 00:23:06 +0100 Subject: [PATCH] test/ostree: add installer test Extend the current ostree container test case to use the new bootiso manifest to build a bootable iso. This is done in the existing container test case in order to share the build root and ostree commit results and speed up testing. In the future, the test infrastructure should be extended so that the cache can be optionally shared between test cases. --- test/run/test_ostree.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/test/run/test_ostree.py b/test/run/test_ostree.py index c2ca2d7b..ba921d0b 100644 --- a/test/run/test_ostree.py +++ b/test/run/test_ostree.py @@ -11,22 +11,32 @@ from .. import test @unittest.skipUnless(test.TestBase.have_test_data(), "no test-data access") @unittest.skipUnless(test.TestBase.can_bind_mount(), "root-only") -class TestBoot(test.TestBase): +class TestOSTree(test.TestBase): def setUp(self): self.osbuild = test.OSBuild(self) - def test_ostree_container_updates(self): - # - # Build a container. - # - - manifest = os.path.join(self.locate_test_data(), - "manifests/fedora-ostree-container.json") - + def test_ostree(self): with self.osbuild as osb: - exports = ["container"] with tempfile.TemporaryDirectory(dir="/var/tmp") as temp_dir: - osb.compile_file(manifest, output_dir=temp_dir, exports=exports) + + # Build a container + manifest = os.path.join(self.locate_test_data(), + "manifests/fedora-ostree-container.json") + osb.compile_file(manifest, + output_dir=temp_dir, + checkpoints=["build", "ostree-tree", "ostree-commit"], + exports=["container"]) oci_archive = os.path.join(temp_dir, "container", "fedora-container.tar") self.assertTrue(os.path.exists(oci_archive)) + + # build a bootable ISO + manifest = os.path.join(self.locate_test_data(), + "manifests/fedora-ostree-bootiso.json") + osb.compile_file(manifest, + output_dir=temp_dir, + checkpoints=["build", "ostree-tree", "ostree-commit"], + exports=["bootiso"]) + + bootiso = os.path.join(temp_dir, "bootiso", "fedora-ostree-boot.iso") + self.assertTrue(os.path.exists(bootiso))