diff --git a/ipatests/pytest_ipa/integration/host.py b/ipatests/pytest_ipa/integration/host.py index 33f7c732a..dca28e584 100644 --- a/ipatests/pytest_ipa/integration/host.py +++ b/ipatests/pytest_ipa/integration/host.py @@ -18,6 +18,7 @@ # along with this program. If not, see . """Host class for integration testing""" +import re import subprocess import tempfile @@ -31,6 +32,8 @@ from .fips import ( is_fips_enabled, enable_userspace_fips, disable_userspace_fips ) +FIPS_NOISE_RE = re.compile(br"FIPS mode initialized\r?\n?") + class LDAPClientWithoutCertCheck(ipaldap.LDAPClient): """Adds an option to disable certificate check for TLS connection @@ -176,6 +179,9 @@ class Host(pytest_multihost.host.Host): log_stdout=log_stdout, raiseonerr=False, cwd=cwd, bg=bg, encoding=encoding ) + # in FIPS mode SSH may print noise to stderr, remove the string + # "FIPS mode initialized" + optional newline. + result.stderr_bytes = FIPS_NOISE_RE.sub(b'', result.stderr_bytes) try: result_ok = result.returncode in ok_returncode except TypeError: