From 0f5405b14825f229b3cf8f2d5f1aefefc080cf84 Mon Sep 17 00:00:00 2001
From: Stanislav Levin <slev@altlinux.org>
Date: Thu, 4 Mar 2021 13:47:14 +0300
Subject: [PATCH] ipatests: Fix expectation about GSS error in test for
 healthcheck

As of 1.19.1 MIT krb changed the error returned if no valid
credentials could be obtained(GSS_S_CRED_UNAVAIL->GSS_S_NO_CRED).
To be compatible with previous versions of krb the new expected
error message has been added.

Fixes: https://pagure.io/freeipa/issue/8737
Signed-off-by: Stanislav Levin <slev@altlinux.org>
---
 .../test_integration/test_ipahealthcheck.py   | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ipatests/test_integration/test_ipahealthcheck.py b/ipatests/test_integration/test_ipahealthcheck.py
index 55ff5ea74b6..c9659396eb3 100644
--- a/ipatests/test_integration/test_ipahealthcheck.py
+++ b/ipatests/test_integration/test_ipahealthcheck.py
@@ -473,11 +473,19 @@ def test_source_ipahealthcheck_ipa_host_check_ipahostkeytab(
         ipahealthcheck.ipa.host when dirsrv service is stopped and
         running on IPA master
         """
-        msg = (
-            "Failed to obtain host TGT: Major (851968): "
-            "Unspecified GSS failure.  "
-            "Minor code may provide more information, "
-            "Minor (2529638972): Generic error (see e-text)"
+        msgs = (
+            (
+                "Failed to obtain host TGT: Major (851968): "
+                "Unspecified GSS failure.  "
+                "Minor code may provide more information, "
+                "Minor (2529638972): Generic error (see e-text)"
+            ),
+            (
+                "Failed to obtain host TGT: Major (458752): "
+                "No credentials were supplied, or the credentials "
+                "were unavailable or inaccessible, "
+                "Minor (2529638972): Generic error (see e-text)"
+            ),
         )
         restart_service(self.master, "dirsrv")
         dirsrv_ipactl_status = 'Directory Service: STOPPED'
@@ -491,7 +499,7 @@ def test_source_ipahealthcheck_ipa_host_check_ipahostkeytab(
         assert returncode == 1
         if dirsrv_ipactl_status in result.stdout_text:
             assert data[0]["result"] == "ERROR"
-            assert data[0]["kw"]["msg"] == msg
+            assert data[0]["kw"]["msg"] in msgs
         else:
             assert data[0]["result"] == "SUCCESS"
 
