summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/manage.py
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2022-03-26 15:41:59 +0200
committerGitHub <noreply@github.com>2022-03-26 15:41:59 +0200
commitaa60d48c2711cdcd9f88a4e5c77379adb0408231 (patch)
tree349631a02467dae0158f6f663cc8aa8537974a97 /tests/cloud_tests/manage.py
parent5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff)
parent31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (diff)
downloadvyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.tar.gz
vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.zip
Merge pull request #51 from zdc/T2117-sagitta-22.1
T2117: Cloud-init updated to 22.1
Diffstat (limited to 'tests/cloud_tests/manage.py')
-rw-r--r--tests/cloud_tests/manage.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/tests/cloud_tests/manage.py b/tests/cloud_tests/manage.py
deleted file mode 100644
index 5f0cfd23..00000000
--- a/tests/cloud_tests/manage.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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
-
-
-_verifier_fmt = textwrap.dedent(
- """
- \"\"\"cloud-init Integration Test Verify Script\"\"\"
- from tests.cloud_tests.testcases import base
-
-
- class {test_class}(base.CloudTestCase):
- \"\"\"
- Name: {test_name}
- Category: {test_category}
- Description: {test_description}
- \"\"\"
- pass
- """
-).lstrip()
-_config_fmt = textwrap.dedent(
- """
- #
- # Name: {test_name}
- # Category: {test_category}
- # Description: {test_description}
- #
- {config}
- """
-).strip()
-
-
-def write_testcase_config(args, fmt_args, testcase_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)
- 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."""
- fmt_args['test_class'] = 'Test{}'.format(
- 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."""
- (test_category, test_name) = args.name.split('/')
- fmt_args = {'test_name': test_name, 'test_category': test_category,
- 'test_description': str(args.description)}
-
- testcase_file = config.name_to_path(args.name)
- verifier_file = os.path.join(
- TESTCASES_DIR, test_category,
- config.name_sanitize(test_name) + VERIFY_EXT)
-
- write_testcase_config(args, fmt_args, testcase_file)
- write_verifier(args, fmt_args, verifier_file)
-
- return 0
-
-# vi: ts=4 expandtab