summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/collect.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-11-21 11:43:26 -0700
committerChad Smith <chad.smith@canonical.com>2017-11-21 11:43:26 -0700
commit5b974bbab161e6cd73751bf27b7741f6b0d19051 (patch)
treef634411a9b12b2e36ff8beefbec39dad21cd45ea /tests/cloud_tests/collect.py
parentc9c7ff70f55ee024dd54336f07ba52acec1f6929 (diff)
parent7624348712b4502f0085d30c05b34dce3f2ceeae (diff)
downloadvyos-cloud-init-5b974bbab161e6cd73751bf27b7741f6b0d19051.tar.gz
vyos-cloud-init-5b974bbab161e6cd73751bf27b7741f6b0d19051.zip
merge from 7624348712b4502f0085d30c05b34dce3f2ceeae at 17.1-41-g76243487
Diffstat (limited to 'tests/cloud_tests/collect.py')
-rw-r--r--tests/cloud_tests/collect.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/cloud_tests/collect.py b/tests/cloud_tests/collect.py
index 4a2422ed..71ee7645 100644
--- a/tests/cloud_tests/collect.py
+++ b/tests/cloud_tests/collect.py
@@ -22,11 +22,21 @@ def collect_script(instance, base_dir, script, script_name):
"""
LOG.debug('running collect script: %s', script_name)
(out, err, exit) = instance.run_script(
- script, rcs=range(0, 256),
+ script.encode(), rcs=False,
description='collect: {}'.format(script_name))
c_util.write_file(os.path.join(base_dir, script_name), out)
+def collect_console(instance, base_dir):
+ LOG.debug('getting console log')
+ try:
+ data = instance.console_log()
+ except NotImplementedError as e:
+ data = 'Not Implemented: %s' % e
+ with open(os.path.join(base_dir, 'console.log'), "wb") as fp:
+ fp.write(data)
+
+
def collect_test_data(args, snapshot, os_name, test_name):
"""Collect data for test case.
@@ -79,8 +89,12 @@ def collect_test_data(args, snapshot, os_name, test_name):
test_output_dir, script, script_name))
for script_name, script in test_scripts.items()]
+ console_log = partial(
+ run_single, 'collect console',
+ partial(collect_console, instance, test_output_dir))
+
res = run_stage('collect for test: {}'.format(test_name),
- [start_call] + collect_calls)
+ [start_call] + collect_calls + [console_log])
return res