tests: Few no-plugin-exception-during-analyses improvements

- when first grep fails print journal as well
- check for setroubleshoot-server instead of setroubleshoot
- improve grep assert to match "passwd" and "/usr/bin/passwd"
This commit is contained in:
Petr Lautrbach 2020-01-06 15:33:20 +01:00
parent 0340721f20
commit 77e7a0320c
1 changed files with 6 additions and 4 deletions

View File

@ -34,21 +34,23 @@ PACKAGE="setroubleshoot"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm ${PACKAGE}
rlAssertRpm ${PACKAGE}-server
rlAssertRpm ${PACKAGE}-plugins
rlPhaseEnd
rlPhaseStartTest "no 'Plugin Exception'"
SINCE=$(date '+%Y-%m-%d %H:%M:%S')
RANDOM_NUMBER=${RANDOM}
rlRun "passwd --help >& /root/output-${RANDOM_NUMBER}.txt"
rlRun "rm -f /root/output-${RANDOM_NUMBER}.txt"
sleep 10
rlRun "journalctl --since=\"$SINCE\" > journal-after.txt"
rlAssertGrep "setroubleshoot.*: SELinux is preventing passwd" journal-after.txt
STATUS=0
rlAssertGrep "setroubleshoot.*: SELinux is preventing (/usr/bin/)?passwd" journal-after.txt -E
[[ $? -eq 0 ]] || STATUS=$?
rlAssertNotGrep "setroubleshoot.*: Plugin Exception " journal-after.txt
rlRun "[[ $? -eq 0 ]] || cat journal-after.txt"
[[ $? -eq 0 ]] || STATUS=$?
rlRun "[[ $STATUS -eq 0 ]] || cat journal-after.txt"
rlPhaseEnd
rlPhaseStartCleanup