diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-10-01 18:23:34 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2018-10-01 18:23:34 +0000 |
commit | 40768bad4c7eb966b2a8c1308cdae22e578b2413 (patch) | |
tree | 0c89c35c6bff4fc827b3703ef5f5f1b6efedd057 /tests/cloud_tests/collect.py | |
parent | c239eb82f1bfe1d0c4b79f2a733f04cfb3277fbf (diff) | |
download | vyos-cloud-init-40768bad4c7eb966b2a8c1308cdae22e578b2413.tar.gz vyos-cloud-init-40768bad4c7eb966b2a8c1308cdae22e578b2413.zip |
tests: allow skipping an entire cloud_test without running.
Individual skipTest or setUp SkipTest will still launch the instance.
This allows us to stop the running of the instance so we don't
waste cycles or boot systems that are known to fail.
Also replace remaining unittest usage in tests/cloud_tests/
with unittest2.
Diffstat (limited to 'tests/cloud_tests/collect.py')
-rw-r--r-- | tests/cloud_tests/collect.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/cloud_tests/collect.py b/tests/cloud_tests/collect.py index 75b50616..642745d8 100644 --- a/tests/cloud_tests/collect.py +++ b/tests/cloud_tests/collect.py @@ -9,6 +9,7 @@ from cloudinit import util as c_util from tests.cloud_tests import (config, LOG, setup_image, util) from tests.cloud_tests.stage import (PlatformComponent, run_stage, run_single) from tests.cloud_tests import platforms +from tests.cloud_tests.testcases import base, get_test_class def collect_script(instance, base_dir, script, script_name): @@ -63,6 +64,7 @@ def collect_test_data(args, snapshot, os_name, test_name): res = ({}, 1) # load test config + test_name_in = test_name test_name = config.path_to_name(test_name) test_config = config.load_test_config(test_name) user_data = test_config['cloud_config'] @@ -75,6 +77,16 @@ def collect_test_data(args, snapshot, os_name, test_name): LOG.warning('test config %s is not enabled, skipping', test_name) return ({}, 0) + test_class = get_test_class( + config.name_to_module(test_name_in), + test_data={'platform': snapshot.platform_name, 'os_name': os_name}, + test_conf=test_config['cloud_config']) + try: + test_class.maybeSkipTest() + except base.SkipTest as s: + LOG.warning('skipping test config %s: %s', test_name, s) + return ({}, 0) + # if testcase requires a feature flag that the image does not support, # skip the testcase with a warning req_features = test_config.get('required_features', []) |