From 40aeec975acdff35468cb4594a7159059226dbd8 Mon Sep 17 00:00:00 2001 From: Mohammad Rizwan Date: Fri, 12 Mar 2021 12:46:09 +0530 Subject: [PATCH] ipatests: introduce wait_for_replication in test_rolecheck_Trust Test was randomly failing if the query for the server role is executed before the replication had time to replicate the changes on cn=adtrust agents,cn=sysaccounts,cn=etc,dc=ipa,dc=test, as the server role is read using this entry. related: https://pagure.io/freeipa/issue/8553 Signed-off-by: Mohammad Rizwan Reviewed-By: Florence Blanc-Renaud --- .../test_backup_and_restore.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ipatests/test_integration/test_backup_and_restore.py b/ipatests/test_integration/test_backup_and_restore.py index e0ef2684f..dcaddb1a1 100644 --- a/ipatests/test_integration/test_backup_and_restore.py +++ b/ipatests/test_integration/test_backup_and_restore.py @@ -1028,6 +1028,13 @@ class TestBackupRoles(IntegrationTest): '-a', self.master.config.admin_password, '--add-sids' ]) + + # wait for replication to propagate the change on + # cn=adtrust agents,cn=sysaccounts,cn=etc,dc=ipa,dc=test + # as the ipa server-role-find call is using this entry to + # build its output + tasks.wait_for_replication(self.replicas[0].ldap_connect()) + # double-check assert self._ipa_replica_role_check( self.replicas[0].hostname, self.serverroles['ADTC'] @@ -1062,6 +1069,13 @@ class TestBackupRoles(IntegrationTest): self.replicas[0].run_command([ 'ipa-adtrust-install', '--add-agents'], stdin_text=cmd_input ) + + # wait for replication to propagate the change on + # cn=adtrust agents,cn=sysaccounts,cn=etc,dc=ipa,dc=test + # as the ipa server-role-find call is using this entry to + # build its output + tasks.wait_for_replication(self.replicas[0].ldap_connect()) + # check that master is now an AD Trust agent assert self._ipa_replica_role_check( self.master.hostname, self.serverroles['ADTA'] @@ -1079,6 +1093,13 @@ class TestBackupRoles(IntegrationTest): '-a', self.master.config.admin_password, '--add-sids' ]) + + # wait for replication to propagate the change on + # cn=adtrust agents,cn=sysaccounts,cn=etc,dc=ipa,dc=test + # as the ipa server-role-find call is using this entry to + # build its output + tasks.wait_for_replication(self.master.ldap_connect()) + # master and replicas[0] are both AD Trust Controllers now. for hostname in [self.master.hostname, self.replicas[0].hostname]: assert self._ipa_replica_role_check(