lorax/test/check-lorax
Brian C. Lane b8b5c02d66 composer-cli: Remove all traces of composer-cli
weldr-client has replaced composer-cli so remove all of the code and
tests, adjust various things so they don't expect it to be available,
and rename some things like test/composertest.py to reflect its
exclusive use by lorax.

(cherry picked from commit b75b692607)
2021-04-26 17:03:31 -07:00

58 lines
1.8 KiB
Python
Executable File

#!/usr/bin/python3
import tempfile
import loraxtest
class LoraxTestCase(loraxtest.TestCase):
def setUp(self):
self.setUpTestMachine()
# Upload the contents of the ./tests/ directory to the machine (it must have beakerlib already installed)
self.machine.upload(["../tests"], "/")
def tearDown(self):
super().tearDownTestMachine()
def runLoraxTest(self, script):
extra_env = []
if self.sit:
extra_env.append("COMPOSER_TEST_FAIL_FAST=1")
r = self.execute(["TEST=" + self.id(),
*extra_env,
"/tests/test_lorax.sh", script])
self.assertEqual(r.returncode, 0)
def runShellTest(self, script):
"""Run a shell script directly, without the beakerlib wrapper"""
extra_env = []
r = self.execute(["TEST=" + self.id(),
*extra_env,
script])
self.assertEqual(r.returncode, 0)
class TestLorax(LoraxTestCase):
def test_boot_iso(self):
self.runLoraxTest("/tests/lorax/test_build_bootiso.sh")
with tempfile.TemporaryDirectory(prefix="/var/tmp/lorax-test.") as tmpdir:
# Copy the resulting iso and shut down the VM
self.tearDownVirt(virt_dir="/var/tmp/test-results/*", local_dir=tmpdir)
# Boot the image, login with ssh (no key needed)
self.setUpTestMachine(tmpdir + "/images/boot.iso")
# Upload the contents of the ./tests/ directory to the machine
self.machine.upload(["../tests"], "/")
# Run the test on the booted image
# NOTE: The boot.iso cannot run beakerlib so this test is called directly
self.runShellTest("/tests/lorax/test_boot_bootiso.sh")
if __name__ == '__main__':
loraxtest.main()