diff options
author | Wesley Wiedenmeier <wesley.wiedenmeier@gmail.com> | 2017-06-08 18:23:31 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-08 18:24:17 -0400 |
commit | 76d58265e34851b78e952a7f275340863c90a9f5 (patch) | |
tree | 91bf17879724b180e43bff07e428bb9089cbb395 /tests/cloud_tests/manage.py | |
parent | ad2680a689ab78847ccce7766d6591797d99e219 (diff) | |
download | vyos-cloud-init-76d58265e34851b78e952a7f275340863c90a9f5.tar.gz vyos-cloud-init-76d58265e34851b78e952a7f275340863c90a9f5.zip |
Integration Testing: tox env, pyxld 2.2.3, and revamp framework
Massive update to clean up and greatly enhance the integration testing
framework developed by Wesley Wiedenmeier.
- Updated tox environment to run integration test 'citest' to utilize
pylxd 2.2.3
- Add support for distro feature flags
- add framework for feature flags to release config with feature groups
and overrides allowed in any release conf override level
- add support for feature flags in platform and config handling
- during collect, skip testcases that require features not supported by
the image with a warning message
- Enable additional distros (i.e. centos, debian)
- Add 'bddeb' command to build a deb from the current working tree
cleanly in a container, so deps do not have to be installed on host
- Adds a command line option '--preserve-data' that ensures that
collected data will be left after tests run. This also allows the
directory to store collected data in during the run command to be
specified using '--data-dir'.
- Updated Read the Docs testing page and doc strings for pep 257
compliance
Diffstat (limited to 'tests/cloud_tests/manage.py')
-rw-r--r-- | tests/cloud_tests/manage.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/cloud_tests/manage.py b/tests/cloud_tests/manage.py index 5342612b..5f0cfd23 100644 --- a/tests/cloud_tests/manage.py +++ b/tests/cloud_tests/manage.py @@ -1,11 +1,15 @@ # This file is part of cloud-init. See LICENSE file for license information. +"""Create test cases automatically given a user_data script.""" + +import os +import textwrap + +from cloudinit import util as c_util from tests.cloud_tests.config import VERIFY_EXT from tests.cloud_tests import (config, util) from tests.cloud_tests import TESTCASES_DIR -import os -import textwrap _verifier_fmt = textwrap.dedent( """ @@ -35,29 +39,24 @@ _config_fmt = textwrap.dedent( def write_testcase_config(args, fmt_args, testcase_file): - """ - write the testcase config file - """ + """Write the testcase config file.""" testcase_config = {'enabled': args.enable, 'collect_scripts': {}} if args.config: testcase_config['cloud_config'] = args.config fmt_args['config'] = util.yaml_format(testcase_config) - util.write_file(testcase_file, _config_fmt.format(**fmt_args), omode='w') + c_util.write_file(testcase_file, _config_fmt.format(**fmt_args), omode='w') def write_verifier(args, fmt_args, verifier_file): - """ - write the verifier script - """ + """Write the verifier script.""" fmt_args['test_class'] = 'Test{}'.format( - config.name_sanatize(fmt_args['test_name']).title()) - util.write_file(verifier_file, _verifier_fmt.format(**fmt_args), omode='w') + config.name_sanitize(fmt_args['test_name']).title()) + c_util.write_file(verifier_file, + _verifier_fmt.format(**fmt_args), omode='w') def create(args): - """ - create a new testcase - """ + """Create a new testcase.""" (test_category, test_name) = args.name.split('/') fmt_args = {'test_name': test_name, 'test_category': test_category, 'test_description': str(args.description)} @@ -65,7 +64,7 @@ def create(args): testcase_file = config.name_to_path(args.name) verifier_file = os.path.join( TESTCASES_DIR, test_category, - config.name_sanatize(test_name) + VERIFY_EXT) + config.name_sanitize(test_name) + VERIFY_EXT) write_testcase_config(args, fmt_args, testcase_file) write_verifier(args, fmt_args, verifier_file) |