ipatests: fix backup and restore

The tests for backup_and_restore check that the ipa-backup command
compresses the tar file AFTER restarting IPA services by reading the
output and looking for a pattern with "gzip" before "Starting IPA service."

As the tar file name is randomly created, it sometimes happen that the
name contains gzip and in this case the test wrongly assumes that
the gzip cmd was called.

The fix makes a stricter comparison, looking for /bin/gzip.

Fixes: https://pagure.io/freeipa/issue/8170
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2020-01-14 13:52:49 +01:00 committed by Rob Crittenden
parent b5b9efeb57
commit ae140ae406

View File

@ -165,7 +165,7 @@ def backup(host):
# Test for ticket 7632: check that services are restarted
# before the backup is compressed
pattern = r'.*gzip.*Starting IPA service.*'
pattern = r'.*{}.*Starting IPA service.*'.format(paths.GZIP)
if (re.match(pattern, result.stderr_text, re.DOTALL)):
raise AssertionError('IPA Services are started after compression')