summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/verify.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-03-16 13:43:31 -0600
committerChad Smith <chad.smith@canonical.com>2018-03-16 13:43:31 -0600
commita1f678f8ebc080d4737f32275f42947b84ae025a (patch)
tree945466e84c4b602de1f1f2b696d43f0d89cb6941 /tests/cloud_tests/verify.py
parent95bb226921b8075ca9f65a9d2b672a3e342498b7 (diff)
downloadvyos-cloud-init-a1f678f8ebc080d4737f32275f42947b84ae025a.tar.gz
vyos-cloud-init-a1f678f8ebc080d4737f32275f42947b84ae025a.zip
cc_snap: Add new module to install and configure snapd and snap packages.
Support installing and configuring snaps on ubuntu systems. Now, cloud-config files can provide a list or dictionary of snap:assertions which will be allow configuration of snapd on a system via 'snap ack' calls. The snap:commands configuration option supports arbitrary system commands intended to interact with snappy's cli. This allows users to run arbitrary snappy commands to create users, download, install and configure snap packages and snapd. This branch also deprecates old snappy and snap_config modules leaving warnings in documentation and runtime for consumers of these modules. Deprecated snap* modules will be dropped in cloud-init v.18.2 release.
Diffstat (limited to 'tests/cloud_tests/verify.py')
-rw-r--r--tests/cloud_tests/verify.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/cloud_tests/verify.py b/tests/cloud_tests/verify.py
index 2a9fd520..5a68a484 100644
--- a/tests/cloud_tests/verify.py
+++ b/tests/cloud_tests/verify.py
@@ -8,13 +8,16 @@ import unittest
from tests.cloud_tests import (config, LOG, util, testcases)
-def verify_data(base_dir, tests):
+def verify_data(data_dir, platform, os_name, tests):
"""Verify test data is correct.
- @param base_dir: base directory for data
+ @param data_dir: top level directory for all tests
+ @param platform: The platform name we for this test data (e.g. lxd)
+ @param os_name: The operating system under test (xenial, artful, etc.).
@param tests: list of test names
@return_value: {<test_name>: {passed: True/False, failures: []}}
"""
+ base_dir = os.sep.join((data_dir, platform, os_name))
runner = unittest.TextTestRunner(verbosity=util.current_verbosity())
res = {}
for test_name in tests:
@@ -26,7 +29,7 @@ def verify_data(base_dir, tests):
cloud_conf = test_conf['cloud_config']
# load script outputs
- data = {}
+ data = {'platform': platform, 'os_name': os_name}
test_dir = os.path.join(base_dir, test_name)
for script_name in os.listdir(test_dir):
with open(os.path.join(test_dir, script_name), 'rb') as fp:
@@ -73,7 +76,7 @@ def verify(args):
# run test
res[platform][os_name] = verify_data(
- os.sep.join((args.data_dir, platform, os_name)),
+ args.data_dir, platform, os_name,
tests[platform][os_name])
# handle results