URL: https://github.com/freeipa/freeipa/pull/6092 Author: mrizwan93 Title: #6092: ipatests: Test cases for ipa-replica-conncheck command Action: opened
PR body: """ Following test cases would be checked: - when called with --principal (it should then prompt for a password) - when called with --principal / --password - when called without principal and password but with a kerberos TGT, kinit admin done before calling ipa-replica-conncheck - when called without principal and password, and without any kerberos TGT (it should default to principal=admin and prompt for a password) Signed-off-by: Mohammad Rizwan <myu...@redhat.com> """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/6092/head:pr6092 git checkout pr6092
From c91aac7c8ee2f4e52fbf457294a091790f9b4fc1 Mon Sep 17 00:00:00 2001 From: Mohammad Rizwan <myu...@redhat.com> Date: Thu, 18 Nov 2021 18:36:58 +0530 Subject: [PATCH 1/2] Test cases for ipa-replica-conncheck command Following test cases would be checked: - when called with --principal (it should then prompt for a password) - when called with --principal / --password - when called without principal and password but with a kerberos TGT, kinit admin done before calling ipa-replica-conncheck - when called without principal and password, and without any kerberos TGT (it should default to principal=admin and prompt for a password) Signed-off-by: Mohammad Rizwan <myu...@redhat.com> --- .../test_replica_promotion.py | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index b9c56f775d0..13a6947a25a 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -437,6 +437,56 @@ def test_renewal_master_with_csreplica_manage(self): self.assertCARenewalMaster(master, replica.hostname) self.assertCARenewalMaster(replica, replica.hostname) + def test_replica_concheck(self): + """Test cases for ipa-replica-conncheck command + + Following test cases would be checked: + - when called with --principal (it should then prompt for a password) + - when called with --principal / --password + - when called without principal and password but with a kerberos TGT, + kinit admin done before calling ipa-replica-conncheck + - when called without principal and password, and without any kerberos + TGT (it should default to principal=admin and prompt for a password) + """ + tasks.kdestroy_all(self.replicas[0]) + # when called with --principal (it should then prompt for a password) + self.replicas[0].run_command( + ['ipa-replica-conncheck', '--auto-master-check', + '--master', self.master.hostname, + '-r', self.replicas[0].domain.realm, + '-p', self.replicas[0].config.admin_name], + stdin_text=self.master.config.admin_password + ) + + # when called with --principal / --password + self.replicas[0].run_command([ + 'ipa-replica-conncheck', '--auto-master-check', + '--master', self.master.hostname, + '-r', self.replicas[0].domain.realm, + '-p', self.replicas[0].config.admin_name, + '-w', self.master.config.admin_password + ]) + + # when called without principal and password, and without + # any kerberos TGT, it should default to principal=admin + # and prompt for a password + self.replicas[0].run_command( + ['ipa-replica-conncheck', '--auto-master-check', + '--master', self.master.hostname, + '-r', self.replicas[0].domain.realm], + stdin_text=self.master.config.admin_password + ) + + # when called without principal and password but with a kerberos TGT, + # kinit admin done before calling ipa-replica-conncheck + tasks.kinit_admin(self.replicas[0]) + self.replicas[0].run_command( + ['ipa-replica-conncheck', '--auto-master-check', + '--master', self.master.hostname, + '-r', self.replicas[0].domain.realm] + ) + tasks.kdestroy_all(self.replicas[0]) + def test_automatic_renewal_master_transfer_ondelete(self): # Test that after replica uninstallation, master overtakes the cert # renewal master role from replica (which was previously set there) From f45cfc013e2d109f3512b34edfdd413210ae9e92 Mon Sep 17 00:00:00 2001 From: Mohammad Rizwan <myu...@redhat.com> Date: Thu, 18 Nov 2021 18:43:22 +0530 Subject: [PATCH 2/2] PEP8 Fixes Signed-off-by: Mohammad Rizwan <myu...@redhat.com> --- .../test_integration/test_replica_promotion.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 13a6947a25a..03de8155ea9 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -138,7 +138,6 @@ def test_install_with_host_auth_ind_set(self): assert res.returncode == 1 assert expected_err in res.stderr_text - @replicas_cleanup def test_one_command_installation(self): """ @@ -150,11 +149,11 @@ def test_one_command_installation(self): Firewall(self.replicas[0]).enable_services(["freeipa-ldap", "freeipa-ldaps"]) self.replicas[0].run_command(['ipa-replica-install', '-w', - self.master.config.admin_password, - '-n', self.master.domain.name, - '-r', self.master.domain.realm, - '--server', self.master.hostname, - '-U']) + self.master.config.admin_password, + '-n', self.master.domain.name, + '-r', self.master.domain.realm, + '--server', self.master.hostname, + '-U']) # Ensure that pkinit is properly configured, test for 7566 result = self.replicas[0].run_command(['ipa-pkinit-manage', 'status']) assert "PKINIT is enabled" in result.stdout_text @@ -321,7 +320,7 @@ def test_upcase_client_domain(self): result1 = client.run_command(['ipa-replica-install', '-U', '-w', self.master.config.dirman_password], raiseonerr=False) - assert(result1.returncode == 0), ( + assert (result1.returncode == 0), ( 'Failed to promote the client installed with the upcase domain name') def test_client_rollback(self): @@ -355,6 +354,7 @@ def test_client_rollback(self): assert("An error occurred while removing SSSD" not in result.stdout_text) + class TestRenewalMaster(IntegrationTest): topology = 'star'
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure