From 555f8a038dae139ad161c5dab51e2378f8894b81 Mon Sep 17 00:00:00 2001 From: sumenon Date: May 14 2020 07:05:03 +0000 Subject: ipatests: Added testcase to check that ipa-adtrust-install command runs successfully with locale set as LANG=en_IN.UTF-8 Issue: https://pagure.io/freeipa/issue/8066 Reviewed-By: Florence Blanc-Renaud Reviewed-By: Rob Crittenden Reviewed-By: Mohammad Rizwan Yusuf --- diff --git a/ipatests/test_integration/test_commands.py b/ipatests/test_integration/test_commands.py index abcd5c5..e33aa28 100644 --- a/ipatests/test_integration/test_commands.py +++ b/ipatests/test_integration/test_commands.py @@ -1136,3 +1136,37 @@ class TestIPACommand(IntegrationTest): raiseonerr=False ) assert result.returncode == 0 + + def test_ipa_adtrust_install_with_locale_issue8066(self): + """ + This test checks that ipa-adtrust-install command runs successfully + on a system with locale en_IN.UTF-8 without displaying error below + 'IndexError: list index out of range' + This is a testcase for Pagure issue + https://pagure.io/freeipa/issue/8066 + """ + # Set locale to en_IN.UTF-8 in .bashrc file to avoid reboot + tasks.kinit_admin(self.master) + BASHRC_CFG = "/root/.bashrc" + bashrc_backup = tasks.FileBackup(self.master, BASHRC_CFG) + exp_msg = "en_IN.UTF-8" + try: + self.master.run_command( + 'echo "export LC_TIME=en_IN.UTF-8" >> ' + BASHRC_CFG + ) + result = self.master.run_command('echo "$LC_TIME"') + assert result.stdout_text.rstrip() == exp_msg + # Install ipa-server-adtrust and check status + msg1 = ( + "Unexpected error - see /var/log/ipaserver-install.log" + "for details" + ) + msg2 = "IndexError: list index out of range" + tasks.install_packages(self.master, ["*ipa-server-trust-ad"]) + result = self.master.run_command( + ["ipa-adtrust-install", "-U"], raiseonerr=False + ) + assert msg1 not in result.stderr_text + assert msg2 not in result.stderr_text + finally: + bashrc_backup.restore()