lorax/test/check-cli
Alexander Todorov f1c15c67e0 tests: Disable non-cli test scenarios b/c osbuild-composer
the image building functionality is now tested by the
osbuild-composer test suite. We weren't successfull at making this
test suite work with the 2 backends so decided to disabled these
scenarios instead. In the future they will likely be deleted.
2020-07-22 08:49:25 -07:00

116 lines
4.3 KiB
Python
Executable File

#!/usr/bin/python3
import unittest
import tempfile
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")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
def test_ext4_filesystem(self):
self.runCliTest("/tests/cli/test_compose_ext4-filesystem.sh")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
def test_partitioned_disk(self):
self.runCliTest("/tests/cli/test_compose_partitioned-disk.sh")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
class TestQcow2(composertest.ComposerTestCase):
def tearDown(self):
super().tearDownTestMachine()
def test_qcow2(self):
self.runCliTest("/tests/cli/test_compose_qcow2.sh")
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 SSH keys to the machine so we can use the existing assertions
# by ssh'ing to localhost
self.machine.upload([tmpdir + "/id_rsa", tmpdir + "/id_rsa.pub"], "/root/.ssh")
# 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")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
class TestLiveIso(composertest.ComposerTestCase):
def tearDown(self):
super().tearDownTestMachine()
def test_live_iso(self):
self.runCliTest("/tests/cli/test_compose_live-iso.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 using the ssh key
self.setUpTestMachine(tmpdir + "/live.iso", 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_live-iso.sh")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
class TestRepos(composertest.ComposerTestCase):
def test_repos_sanity(self):
self.runCliTest("/tests/cli/test_repos_sanity.sh")
@unittest.skip("Image building is now tested by osbuild-composer test suite")
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")
with tempfile.TemporaryDirectory(prefix="/var/tmp/lorax-test.") as tmpdir:
# Copy the resulting disk image and shut down the VM
self.tearDownVirt(virt_dir="/var/tmp/test-results/*", local_dir=tmpdir)
# Boot the image, login using the ssh key
self.setUpTestMachine(tmpdir + "/disk.img", tmpdir + "/id_rsa")
# Upload SSH keys to the machine so we can use the existing assertions
# by ssh'ing to localhost
self.machine.upload([tmpdir + "/id_rsa", tmpdir + "/id_rsa.pub"], "/root/.ssh")
# 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_tar_kickstart.sh")
if __name__ == '__main__':
composertest.main()