[tests] Collect compose logs after each build
- save compose logs under /var/log/$TEST
- save qemu logs under /var/log/$TEST/qemu.log
- download everything to $TEST_ATTACHMENTS so it can be saved
in CI results
Cherry-picked from 8af9723c
Related: rhbz#1770193
This commit is contained in:
parent
a8d7841bc1
commit
8b8f5355bf
@ -54,6 +54,9 @@ class ComposerTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(r.returncode, 0)
|
self.assertEqual(r.returncode, 0)
|
||||||
|
|
||||||
def tearDown(self):
|
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
|
# 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)
|
# 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])
|
errors = list(e[1] for e in self._outcome.errors if e[1])
|
||||||
|
@ -26,8 +26,10 @@ export SSH_PORT=2222
|
|||||||
boot_image() {
|
boot_image() {
|
||||||
QEMU_BOOT=$1
|
QEMU_BOOT=$1
|
||||||
TIMEOUT=$2
|
TIMEOUT=$2
|
||||||
rlRun -t -c "$QEMU -m 2048 $QEMU_BOOT -nographic \
|
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)
|
# wait for ssh to become ready (yes, http is the wrong protocol, but it returns the header)
|
||||||
tries=0
|
tries=0
|
||||||
until curl -sS -m 15 "http://localhost:$SSH_PORT/" | grep 'OpenSSH'; do
|
until curl -sS -m 15 "http://localhost:$SSH_PORT/" | grep 'OpenSSH'; do
|
||||||
@ -162,6 +164,10 @@ wait_for_compose() {
|
|||||||
rlLogInfo "Waiting for compose to finish ..."
|
rlLogInfo "Waiting for compose to finish ..."
|
||||||
done;
|
done;
|
||||||
check_compose_status "$UUID"
|
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
|
else
|
||||||
rlFail "Compose UUID is empty!"
|
rlFail "Compose UUID is empty!"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user