diff --git a/test/composertest.py b/test/composertest.py index f8a49dae..3c577772 100644 --- a/test/composertest.py +++ b/test/composertest.py @@ -54,6 +54,9 @@ class ComposerTestCase(unittest.TestCase): self.assertEqual(r.returncode, 0) def tearDown(self): + if os.environ.get('TEST_ATTACHMENTS'): + self.machine.download_dir('/var/log/tests', os.environ.get('TEST_ATTACHMENTS')) + # Peek into internal data structure, because there's no way to get the # TestResult at this point. `errors` is a list of tuples (method, error) errors = list(e[1] for e in self._outcome.errors if e[1]) diff --git a/tests/cli/lib/lib.sh b/tests/cli/lib/lib.sh index 6dc58f24..c4c46d68 100755 --- a/tests/cli/lib/lib.sh +++ b/tests/cli/lib/lib.sh @@ -24,7 +24,9 @@ boot_image() { QEMU_BOOT=$1 TIMEOUT=$2 rlRun -t -c "$QEMU -m 2048 $QEMU_BOOT -nographic -monitor none \ - -net user,id=nic0,hostfwd=tcp::$SSH_PORT-:22 -net nic &" + -net user,id=nic0,hostfwd=tcp::$SSH_PORT-:22 -net nic \ + -chardev null,id=log0,mux=on,logfile=/var/log$TEST/qemu.log,logappend=on \ + -serial chardev:log0 &" # wait for ssh to become ready (yes, http is the wrong protocol, but it returns the header) tries=0 until curl -sS -m 15 "http://localhost:$SSH_PORT/" | grep 'OpenSSH'; do @@ -107,6 +109,10 @@ wait_for_compose() { rlLogInfo "Waiting for compose to finish ..." done; check_compose_status "$UUID" + + rlRun -t -c "mkdir -p /var/log/$TEST" + rlRun -t -c "$CLI compose logs $UUID" + rlRun -t -c "mv $UUID-logs.tar /var/log/$TEST" else rlFail "Compose UUID is empty!" fi diff --git a/tests/test_cli.sh b/tests/test_cli.sh index ddf0516b..a253de12 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -89,7 +89,6 @@ until curl -m 15 --unix-socket /run/weldr/api.socket http://localhost:4000/api/s echo "DEBUG: Waiting for backend API to become ready before testing ..." done; - export BEAKERLIB_JOURNAL=0 if [ -z "$*" ]; then # invoke cli/ tests which can be executed without special preparation