From acf31d043f9e22852800f8c53917ba8d1879ce39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= Date: Thu, 4 Mar 2021 10:15:35 +0100 Subject: [PATCH] ipatests: use wait_for_replication for hidden replica checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, hidden replica checks were run without waiting for replication to complete, potentially leading to unstable behavior. Use wait_for_replication. Fixes: https://pagure.io/freeipa/issue/8534 Signed-off-by: François Cami Reviewed-By: Florence Blanc-Renaud Reviewed-By: Rob Crittenden Reviewed-By: Mohammad Rizwan Yusuf --- .../test_integration/test_replica_promotion.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py index 84c03de15..80fb2184a 100644 --- a/ipatests/test_integration/test_replica_promotion.py +++ b/ipatests/test_integration/test_replica_promotion.py @@ -951,8 +951,11 @@ class TestHiddenReplicaPromotion(IntegrationTest): self.replicas[0].hostname, '--state=enabled' ]) self._check_server_role(self.replicas[0], 'enabled') - self._check_dnsrecords([self.master, self.replicas[0]]) + tasks.wait_for_replication( + self.replicas[0].ldap_connect() + ) self._check_config([self.master, self.replicas[0]]) + self._check_dnsrecords([self.master, self.replicas[0]]) result = self.replicas[0].run_command([ 'ipa', 'server-state', @@ -967,6 +970,10 @@ class TestHiddenReplicaPromotion(IntegrationTest): self.replicas[0].hostname, '--state=hidden' ]) self._check_server_role(self.replicas[0], 'hidden') + tasks.wait_for_replication( + self.replicas[0].ldap_connect() + ) + self._check_config([self.master], [self.replicas[0]]) self._check_dnsrecords([self.master], [self.replicas[0]]) def test_replica_from_hidden(self): @@ -1030,14 +1037,11 @@ class TestHiddenReplicaPromotion(IntegrationTest): stdin_text=dirman_password + '\nyes' ) - # wait for the replica to be available - tasks.wait_for_ipa_to_start(self.replicas[0]) - - # give replication some time - time.sleep(5) + tasks.kinit_admin(self.master) tasks.kinit_admin(self.replicas[0]) - # FIXME: restore turns hidden replica into enabled replica + # restore turns a hidden replica into an enabled replica + # https://pagure.io/freeipa/issue/7894 self._check_config([self.master, self.replicas[0]]) self._check_server_role(self.replicas[0], 'enabled')