diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-01-25 12:26:34 -0700 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-01-25 12:26:34 -0700 |
commit | bc84f5023f795c261e32cf0690b2d29e12cfaedd (patch) | |
tree | 273896aca6e94badb3390aa87cfd240fe161d528 /tests/cloud_tests/testcases.yaml | |
parent | bccee93d398ab26a3ee3b427b8f26a7de8375af3 (diff) | |
download | vyos-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.yaml')
-rw-r--r-- | tests/cloud_tests/testcases.yaml | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/cloud_tests/testcases.yaml b/tests/cloud_tests/testcases.yaml index 7183e017..8e0fb62f 100644 --- a/tests/cloud_tests/testcases.yaml +++ b/tests/cloud_tests/testcases.yaml @@ -7,22 +7,37 @@ base_test_data: #cloud-config collect_scripts: cloud-init.log: | - #!/bin/bash + #!/bin/sh cat /var/log/cloud-init.log cloud-init-output.log: | - #!/bin/bash + #!/bin/sh cat /var/log/cloud-init-output.log instance-id: | - #!/bin/bash + #!/bin/sh cat /run/cloud-init/.instance-id result.json: | - #!/bin/bash + #!/bin/sh cat /run/cloud-init/result.json status.json: | - #!/bin/bash + #!/bin/sh cat /run/cloud-init/status.json cloud-init-version: | - #!/bin/bash + #!/bin/sh dpkg-query -W -f='${Version}' cloud-init + system.journal.gz: | + #!/bin/sh + [ -d /run/systemd ] || { echo "not systemd."; exit 0; } + fail() { echo "ERROR:" "$@" 1>&2; exit 1; } + journal="" + for d in /run/log/journal /var/log/journal; do + for f in $d/*/system.journal; do + [ -f "$f" ] || continue + [ -z "$journal" ] || + fail "multiple journal found: $f $journal." + journal="$f" + done + done + [ -f "$journal" ] || fail "no journal file found." + gzip --to-stdout "$journal" # vi: ts=4 expandtab |