-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP New test to check logs for errors
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'" |