|
|
bb0ded |
From 1d19b860d4cd3bd65a4b143b588425d9a64237fd Mon Sep 17 00:00:00 2001
|
|
|
bb0ded |
From: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
bb0ded |
Date: Thu, 18 Nov 2021 18:36:58 +0530
|
|
|
bb0ded |
Subject: [PATCH] Test cases for ipa-replica-conncheck command
|
|
|
bb0ded |
|
|
|
bb0ded |
Following test cases would be checked:
|
|
|
bb0ded |
- when called with --principal (it should then prompt for a password)
|
|
|
bb0ded |
- when called with --principal / --password
|
|
|
bb0ded |
- when called without principal and password but with a kerberos TGT,
|
|
|
bb0ded |
kinit admin done before calling ipa-replica-conncheck
|
|
|
bb0ded |
- when called without principal and password, and without any kerberos
|
|
|
bb0ded |
TGT (it should default to principal=admin and prompt for a password)
|
|
|
bb0ded |
|
|
|
bb0ded |
related: https://pagure.io/freeipa/issue/9047
|
|
|
bb0ded |
|
|
|
bb0ded |
Signed-off-by: Mohammad Rizwan <myusuf@redhat.com>
|
|
|
bb0ded |
---
|
|
|
bb0ded |
.../test_replica_promotion.py | 70 +++++++++++++++++++
|
|
|
bb0ded |
1 file changed, 70 insertions(+)
|
|
|
bb0ded |
|
|
|
bb0ded |
diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
|
|
|
bb0ded |
index b9c56f775d08885cb6b1226eeb7bcf105f87cdc1..1a4e9bc121abf41a3919aedda3d334de9404d1a0 100644
|
|
|
bb0ded |
--- a/ipatests/test_integration/test_replica_promotion.py
|
|
|
bb0ded |
+++ b/ipatests/test_integration/test_replica_promotion.py
|
|
|
bb0ded |
@@ -437,6 +437,76 @@ class TestRenewalMaster(IntegrationTest):
|
|
|
bb0ded |
self.assertCARenewalMaster(master, replica.hostname)
|
|
|
bb0ded |
self.assertCARenewalMaster(replica, replica.hostname)
|
|
|
bb0ded |
|
|
|
bb0ded |
+ def test_replica_concheck(self):
|
|
|
bb0ded |
+ """Test cases for ipa-replica-conncheck command
|
|
|
bb0ded |
+
|
|
|
bb0ded |
+ Following test cases would be checked:
|
|
|
bb0ded |
+ - when called with --principal (it should then prompt for a password)
|
|
|
bb0ded |
+ - when called with --principal / --password
|
|
|
bb0ded |
+ - when called without principal and password but with a kerberos TGT,
|
|
|
bb0ded |
+ kinit admin done before calling ipa-replica-conncheck
|
|
|
bb0ded |
+ - when called without principal and password, and without any kerberos
|
|
|
bb0ded |
+ TGT (it should default to principal=admin and prompt for a password)
|
|
|
bb0ded |
+
|
|
|
bb0ded |
+ related: https://pagure.io/freeipa/issue/9047
|
|
|
bb0ded |
+ """
|
|
|
bb0ded |
+ exp_str1 = "Connection from replica to master is OK."
|
|
|
bb0ded |
+ exp_str2 = "Connection from master to replica is OK"
|
|
|
bb0ded |
+ tasks.kdestroy_all(self.replicas[0])
|
|
|
bb0ded |
+ # when called with --principal (it should then prompt for a password)
|
|
|
bb0ded |
+ result = self.replicas[0].run_command(
|
|
|
bb0ded |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
bb0ded |
+ '--master', self.master.hostname,
|
|
|
bb0ded |
+ '-r', self.replicas[0].domain.realm,
|
|
|
bb0ded |
+ '-p', self.replicas[0].config.admin_name],
|
|
|
bb0ded |
+ stdin_text=self.master.config.admin_password
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+ assert result.returncode == 0
|
|
|
bb0ded |
+ assert (
|
|
|
bb0ded |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+
|
|
|
bb0ded |
+ # when called with --principal / --password
|
|
|
bb0ded |
+ result = self.replicas[0].run_command([
|
|
|
bb0ded |
+ 'ipa-replica-conncheck', '--auto-master-check',
|
|
|
bb0ded |
+ '--master', self.master.hostname,
|
|
|
bb0ded |
+ '-r', self.replicas[0].domain.realm,
|
|
|
bb0ded |
+ '-p', self.replicas[0].config.admin_name,
|
|
|
bb0ded |
+ '-w', self.master.config.admin_password
|
|
|
bb0ded |
+ ])
|
|
|
bb0ded |
+ assert result.returncode == 0
|
|
|
bb0ded |
+ assert (
|
|
|
bb0ded |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+
|
|
|
bb0ded |
+ # when called without principal and password, and without
|
|
|
bb0ded |
+ # any kerberos TGT, it should default to principal=admin
|
|
|
bb0ded |
+ # and prompt for a password
|
|
|
bb0ded |
+ result = self.replicas[0].run_command(
|
|
|
bb0ded |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
bb0ded |
+ '--master', self.master.hostname,
|
|
|
bb0ded |
+ '-r', self.replicas[0].domain.realm],
|
|
|
bb0ded |
+ stdin_text=self.master.config.admin_password
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+ assert result.returncode == 0
|
|
|
bb0ded |
+ assert (
|
|
|
bb0ded |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+
|
|
|
bb0ded |
+ # when called without principal and password but with a kerberos TGT,
|
|
|
bb0ded |
+ # kinit admin done before calling ipa-replica-conncheck
|
|
|
bb0ded |
+ tasks.kinit_admin(self.replicas[0])
|
|
|
bb0ded |
+ result = self.replicas[0].run_command(
|
|
|
bb0ded |
+ ['ipa-replica-conncheck', '--auto-master-check',
|
|
|
bb0ded |
+ '--master', self.master.hostname,
|
|
|
bb0ded |
+ '-r', self.replicas[0].domain.realm]
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+ assert result.returncode == 0
|
|
|
bb0ded |
+ assert (
|
|
|
bb0ded |
+ exp_str1 in result.stderr_text and exp_str2 in result.stderr_text
|
|
|
bb0ded |
+ )
|
|
|
bb0ded |
+ tasks.kdestroy_all(self.replicas[0])
|
|
|
bb0ded |
+
|
|
|
bb0ded |
def test_automatic_renewal_master_transfer_ondelete(self):
|
|
|
bb0ded |
# Test that after replica uninstallation, master overtakes the cert
|
|
|
bb0ded |
# renewal master role from replica (which was previously set there)
|
|
|
bb0ded |
--
|
|
|
bb0ded |
2.34.1
|
|
|
bb0ded |
|