diff options
author | Daniel Watkins <oddbloke@ubuntu.com> | 2020-12-03 13:17:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 13:17:55 -0500 |
commit | 6c4e87bf336073183f8ae8964366d574c7ee4823 (patch) | |
tree | 23cf3538e08f86986ef9a363b525c1f9b96a84aa /tests/integration_tests/conftest.py | |
parent | ed9bd19ca88e4c6458c95d26151c734112615e9a (diff) | |
download | vyos-cloud-init-6c4e87bf336073183f8ae8964366d574c7ee4823.tar.gz vyos-cloud-init-6c4e87bf336073183f8ae8964366d574c7ee4823.zip |
integration_tests: introduce skipping of tests by OS (#702)
This introduces an optional, more complex OS_IMAGE format (`<image
id>::<os>::<release>`) which allows the specification of the OS/OS
release which the given image ID corresponds to. This information is
used to skip tests which do not apply to the image.
This commit is comprised of the following discrete changes:
* introduce the IntegrationImage class, to handle parsing and storing
the new OS_IMAGE format
* support inferring the OS and OS release of Ubuntu series, so that we
can continue to set OS_IMAGE to just a series name and have test
skipping work
* add documentation on Image Selection to integration_tests.rst
* introduce the actual skipping behaviour based on OS marks
* apply the `ubuntu` mark to all tests that should be skipped on
non-Ubuntu operating systems
Diffstat (limited to 'tests/integration_tests/conftest.py')
-rw-r--r-- | tests/integration_tests/conftest.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py index d7e0fca2..cc545b0f 100644 --- a/tests/integration_tests/conftest.py +++ b/tests/integration_tests/conftest.py @@ -10,12 +10,13 @@ from pathlib import Path from tests.integration_tests import integration_settings from tests.integration_tests.clouds import ( + AzureCloud, Ec2Cloud, GceCloud, - AzureCloud, - OciCloud, + ImageSpecification, LxdContainerCloud, LxdVmCloud, + OciCloud, ) from tests.integration_tests.instances import IntegrationInstance @@ -32,6 +33,7 @@ platforms = { 'lxd_container': LxdContainerCloud, 'lxd_vm': LxdVmCloud, } +os_list = ["ubuntu"] session_start_time = datetime.datetime.now().strftime('%y%m%d%H%M%S') @@ -60,6 +62,12 @@ def pytest_runtest_setup(item): if supported_platforms and current_platform not in supported_platforms: pytest.skip(unsupported_message) + image = ImageSpecification.from_os_image() + current_os = image.os + supported_os_set = set(os_list).intersection(test_marks) + if current_os and supported_os_set and current_os not in supported_os_set: + pytest.skip("Cannot run on OS {}".format(current_os)) + # disable_subp_usage is defined at a higher level, but we don't # want it applied here |