tests: fix logging network info on failed test

- log from requested VM
- use 'critical' log level to reach journalctl
- log /var/log/xen/xen-hotplug.log too
This commit is contained in:
Marek Marczykowski-Górecki 2020-11-13 04:39:22 +01:00
parent 79fb0cade1
commit 8233009e2a
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -92,9 +92,9 @@ class VmNetworkingMixin(object):
if not vm.is_running():
return
with contextlib.suppress(subprocess.CalledProcessError):
output = self.loop.run_until_complete(
self.testnetvm.run_for_stdio(cmd, user='root'))
self.log.error('{}: {}: {}'.format(vm.name, cmd, output))
output, _ = self.loop.run_until_complete(
vm.run_for_stdio(cmd, user='root', stderr=subprocess.STDOUT))
self.log.critical('{}: {}: {}'.format(vm.name, cmd, output))
def tearDown(self):
# collect more info on failure
@ -110,6 +110,7 @@ class VmNetworkingMixin(object):
self._run_cmd_and_log_output(vm, 'systemctl --no-pager status qubes-firewall')
self._run_cmd_and_log_output(vm, 'systemctl --no-pager status qubes-iptables')
self._run_cmd_and_log_output(vm, 'systemctl --no-pager status xendriverdomain')
self._run_cmd_and_log_output(vm, 'cat /var/log/xen/xen-hotplug.log')
super(VmNetworkingMixin, self).tearDown()