summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/collect.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-01-25 12:26:34 -0700
committerChad Smith <chad.smith@canonical.com>2018-01-25 12:26:34 -0700
commitbc84f5023f795c261e32cf0690b2d29e12cfaedd (patch)
tree273896aca6e94badb3390aa87cfd240fe161d528 /tests/cloud_tests/collect.py
parentbccee93d398ab26a3ee3b427b8f26a7de8375af3 (diff)
downloadvyos-cloud-init-bc84f5023f795c261e32cf0690b2d29e12cfaedd.tar.gz
vyos-cloud-init-bc84f5023f795c261e32cf0690b2d29e12cfaedd.zip
tests: Collect script output as binary, collect systemd journal, fix lxd.
This adds collection a gzip compressed systemd journal on systemd systems. The file can later be reviewed with:   zcat system.journal.gz > system.journal   journalctl --file=system.journal [-o short-monotonic ..] To support this:   * modify test harness infrastructure to not assume content is utf-8.   * fix lxd platform to support make '_execute' return bytes rather     than a string. https://github.com/lxc/pylxd/issues/268 Also switched the base collectors to use /bin/sh as others already did.
Diffstat (limited to 'tests/cloud_tests/collect.py')
-rw-r--r--tests/cloud_tests/collect.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cloud_tests/collect.py b/tests/cloud_tests/collect.py
index 33acbb1e..5ea88e50 100644
--- a/tests/cloud_tests/collect.py
+++ b/tests/cloud_tests/collect.py
@@ -24,6 +24,13 @@ def collect_script(instance, base_dir, script, script_name):
(out, err, exit) = instance.run_script(
script.encode(), rcs=False,
description='collect: {}'.format(script_name))
+ if err:
+ LOG.debug("collect script %s had stderr: %s", script_name, err)
+ if not isinstance(out, bytes):
+ raise util.PlatformError(
+ "Collection of '%s' returned type %s, expected bytes: %s" %
+ (script_name, type(out), out))
+
c_util.write_file(os.path.join(base_dir, script_name), out)