summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases/base.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/testcases/base.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/testcases/base.py')
-rw-r--r--tests/cloud_tests/testcases/base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
index 1c5b5405..20e95955 100644
--- a/tests/cloud_tests/testcases/base.py
+++ b/tests/cloud_tests/testcases/base.py
@@ -30,12 +30,14 @@ class CloudTestCase(unittest.TestCase):
raise AssertionError('Key "{}" not in cloud config'.format(name))
return self.cloud_config[name]
- def get_data_file(self, name):
+ def get_data_file(self, name, decode=True):
"""Get data file failing test if it is not present."""
if name not in self.data:
raise AssertionError('File "{}" missing from collect data'
.format(name))
- return self.data[name]
+ if not decode:
+ return self.data[name]
+ return self.data[name].decode('utf-8')
def get_instance_id(self):
"""Get recorded instance id."""