2019-06-25 09:50:37 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
2019-10-15 23:46:50 +00:00
|
|
|
import tempfile
|
2019-07-29 09:52:09 +00:00
|
|
|
import unittest
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
import composertest
|
|
|
|
|
|
|
|
|
|
|
|
class TestImages(composertest.ComposerTestCase):
|
|
|
|
"""
|
|
|
|
This is the "entry-point" to the test suite when
|
|
|
|
executed in Cockpit CI. If $TEST_SCENARIO=="" or
|
|
|
|
$TEST_SCENARIO="images" we end up here.
|
|
|
|
|
|
|
|
New test methods should be added here first!
|
|
|
|
When this target becomes too slow we split out into
|
|
|
|
separate scenarios!
|
|
|
|
"""
|
|
|
|
def test_blueprint_sanity(self):
|
|
|
|
self.runCliTest("/tests/cli/test_blueprints_sanity.sh")
|
|
|
|
|
|
|
|
def test_compose_sanity(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_sanity.sh")
|
|
|
|
|
|
|
|
def test_ext4_filesystem(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_ext4-filesystem.sh")
|
|
|
|
|
|
|
|
def test_partitioned_disk(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_partitioned-disk.sh")
|
|
|
|
|
|
|
|
|
2019-07-29 09:52:09 +00:00
|
|
|
@unittest.skip('Nested KVM seems to be buggy and software emulation is too slow')
|
2019-06-25 09:50:37 +00:00
|
|
|
class TestQcow2(composertest.ComposerTestCase):
|
2019-10-15 23:46:50 +00:00
|
|
|
def tearDown(self):
|
|
|
|
super().tearDownTestMachine()
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
def test_qcow2(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_qcow2.sh")
|
|
|
|
|
2019-10-15 23:46:50 +00:00
|
|
|
with tempfile.TemporaryDirectory(prefix="/var/tmp/lorax-test.") as tmpdir:
|
|
|
|
# Copy the resulting qcow2 image and shut down the VM
|
|
|
|
self.tearDownVirt(virt_dir="/var/tmp/test-results/*", local_dir=tmpdir)
|
|
|
|
|
|
|
|
# Boot the image
|
|
|
|
self.setUpTestMachine(tmpdir + "/disk.qcow2", tmpdir + "/id_rsa")
|
|
|
|
|
|
|
|
# Upload the contents of the ./tests/ directory to the machine
|
|
|
|
self.machine.upload(["../tests"], "/")
|
|
|
|
|
|
|
|
# Run the test, on the booted image
|
|
|
|
self.runImageTest("/tests/cli/test_boot_qcow2.sh")
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
|
2019-07-29 09:52:09 +00:00
|
|
|
@unittest.skip('Nested KVM seems to be buggy and software emulation is too slow')
|
2019-06-25 09:50:37 +00:00
|
|
|
class TestLiveIso(composertest.ComposerTestCase):
|
2019-10-15 23:46:50 +00:00
|
|
|
def tearDown(self):
|
|
|
|
super().tearDownTestMachine()
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
def test_live_iso(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_live-iso.sh")
|
|
|
|
|
2019-10-15 23:46:50 +00:00
|
|
|
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
|
|
|
|
self.setUpTestMachine(tmpdir + "/live.iso")
|
|
|
|
|
|
|
|
# Upload the contents of the ./tests/ directory to the machine
|
|
|
|
self.machine.upload(["../tests"], "/")
|
|
|
|
|
|
|
|
# Run the test, on the booted image
|
|
|
|
self.runImageTest("/tests/cli/test_boot_live-iso.sh")
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
|
2019-06-26 13:57:25 +00:00
|
|
|
class TestTar(composertest.ComposerTestCase):
|
|
|
|
def test_tar(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_tar.sh")
|
|
|
|
|
|
|
|
def test_tar_kickstart(self):
|
|
|
|
self.runCliTest("/tests/cli/test_compose_tar_kickstart.sh")
|
|
|
|
|
|
|
|
|
2019-06-25 09:50:37 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
composertest.main()
|