diff --git a/tests/system/test_checklogs.py b/tests/system/test_checklogs.py new file mode 100644 index 000000000..8f8fb7061 --- /dev/null +++ b/tests/system/test_checklogs.py @@ -0,0 +1,25 @@ +import os + +import pytest + +from lib.commands import ssh + +# tests meant to check system logs for error right after installation +# (not after other tests which may willingly cause such errors) + +@pytest.mark.parametrize("logfile", ("xensource.log", "daemon.log", "SMlog")) +def test_logs(host, logfile): + LOGFILE = os.path.join("/var/log/installer", logfile) + + result = host.ssh(["grep -B1 -Ei 'error|fail|fatal|critical|No such file'", LOGFILE], + check=False, simple_output=False) + assert result.returncode == 0, f"Errors in {logfile}, see debug output" + +# FIXME too many false positives to be a real test, essentially useful +# to get the matches extracted and archived for manual verification +def test_install_logs(host): + LOGFILE = "/var/log/installer/install-log" + + result = host.ssh(["grep -B1 -Ei 'error|fail|fatal|critical|No such file'", LOGFILE], + check=False, simple_output=False) + assert result.returncode in (0, 1), "error in 'ssh grep'"