0fcb1e
From 2520a7adff7a49ddcddaaf19f0e586425dc0d878 Mon Sep 17 00:00:00 2001
0fcb1e
From: Filip Dvorak <fdvorak@redhat.com>
0fcb1e
Date: Tue, 6 Dec 2022 15:51:27 +0100
0fcb1e
Subject: [PATCH] ipa tests: Add LANG before kinit command to fix issue with
0fcb1e
 locale settings
0fcb1e
0fcb1e
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
0fcb1e
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
0fcb1e
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
0fcb1e
Reviewed-By: Michal Polovka <mpolovka@redhat.com>
0fcb1e
---
0fcb1e
 ipatests/test_integration/test_krbtpolicy.py | 20 ++++++++++----------
0fcb1e
 1 file changed, 10 insertions(+), 10 deletions(-)
0fcb1e
0fcb1e
diff --git a/ipatests/test_integration/test_krbtpolicy.py b/ipatests/test_integration/test_krbtpolicy.py
0fcb1e
index eae16247bdfb195c1d91209cf2d11eac4c25018f..269cfb0a191821c229aaeb5a3eda0181c6e3ae62 100644
0fcb1e
--- a/ipatests/test_integration/test_krbtpolicy.py
0fcb1e
+++ b/ipatests/test_integration/test_krbtpolicy.py
0fcb1e
@@ -23,7 +23,7 @@ PASSWORD = "Secret123"
0fcb1e
 USER1 = "testuser1"
0fcb1e
 USER2 = "testuser2"
0fcb1e
 MAXLIFE = 86400
0fcb1e
-
0fcb1e
+LANG_PKG = ["langpacks-en"]
0fcb1e
 
0fcb1e
 def maxlife_within_policy(input, maxlife, slush=3600):
0fcb1e
     """Given klist output of the TGT verify that it is within policy
0fcb1e
@@ -45,7 +45,6 @@ def maxlife_within_policy(input, maxlife, slush=3600):
0fcb1e
 
0fcb1e
     return maxlife >= diff >= maxlife - slush
0fcb1e
 
0fcb1e
-
0fcb1e
 @pytest.fixture
0fcb1e
 def reset_to_default_policy():
0fcb1e
     """Reset default user authentication and user authentication type"""
0fcb1e
@@ -70,7 +69,7 @@ def reset_to_default_policy():
0fcb1e
 def kinit_check_life(master, user):
0fcb1e
     """Acquire a TGT and check if it's within the lifetime window"""
0fcb1e
     master.run_command(["kinit", user], stdin_text=f"{PASSWORD}\n")
0fcb1e
-    result = master.run_command("klist | grep krbtgt")
0fcb1e
+    result = master.run_command("LANG=en_US.utf-8 klist | grep krbtgt")
0fcb1e
     assert maxlife_within_policy(result.stdout_text, MAXLIFE) is True
0fcb1e
 
0fcb1e
 
0fcb1e
@@ -81,6 +80,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
 
0fcb1e
     @classmethod
0fcb1e
     def install(cls, mh):
0fcb1e
+        tasks.install_packages(cls.master, LANG_PKG)
0fcb1e
         tasks.install_master(cls.master)
0fcb1e
         tasks.create_active_user(cls.master, USER1, PASSWORD)
0fcb1e
         tasks.create_active_user(cls.master, USER2, PASSWORD)
0fcb1e
@@ -100,7 +100,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
 
0fcb1e
         master.run_command(['kinit', USER1],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command("LANG=en_US.utf-8 klist | grep krbtgt")
0fcb1e
         assert maxlife_within_policy(result.stdout_text, MAXLIFE) is True
0fcb1e
 
0fcb1e
     def test_krbtpolicy_password_and_hardended(self):
0fcb1e
@@ -122,7 +122,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
 
0fcb1e
         master.run_command(['kinit', USER1],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, 600,
0fcb1e
                                      slush=600) is True
0fcb1e
 
0fcb1e
@@ -131,7 +131,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
         # Verify that the short policy only applies to USER1
0fcb1e
         master.run_command(['kinit', USER2],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, MAXLIFE) is True
0fcb1e
 
0fcb1e
     def test_krbtpolicy_hardended(self):
0fcb1e
@@ -151,7 +151,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
 
0fcb1e
         master.run_command(['kinit', USER1],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, 1800,
0fcb1e
                                      slush=1800) is True
0fcb1e
 
0fcb1e
@@ -160,7 +160,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
         # Verify that the short policy only applies to USER1
0fcb1e
         master.run_command(['kinit', USER2],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, MAXLIFE) is True
0fcb1e
 
0fcb1e
     def test_krbtpolicy_password(self):
0fcb1e
@@ -173,7 +173,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
 
0fcb1e
         master.run_command(['kinit', USER2],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, 1200,
0fcb1e
                                      slush=1200) is True
0fcb1e
 
0fcb1e
@@ -183,7 +183,7 @@ class TestPWPolicy(IntegrationTest):
0fcb1e
         master.run_command(['ipa', 'krbtpolicy-reset', USER2])
0fcb1e
         master.run_command(['kinit', USER2],
0fcb1e
                            stdin_text=PASSWORD + '\n')
0fcb1e
-        result = master.run_command('klist | grep krbtgt')
0fcb1e
+        result = master.run_command('LANG=en_US.utf-8 klist | grep krbtgt')
0fcb1e
         assert maxlife_within_policy(result.stdout_text, MAXLIFE) is True
0fcb1e
 
0fcb1e
     def test_krbtpolicy_otp(self, reset_to_default_policy):
0fcb1e
-- 
0fcb1e
2.39.1
0fcb1e