From fdaad3a45f5674876fd3f6cc7ad1e916ebfc7080 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Aug 14 2023 13:02:20 +0000 Subject: ipatests: fix test_topology The test TestTopologyOptions::test_add_remove_segment is randomly failing downstream. Test scenario: - create a line topology master <-> repl1 <-> repl2 - create user on master - wait for repl success on master - check that the user is seen on repl2 The test waits for replication to complete on the master but it should also wait for the replication to complete on repl1 before checking the user presence on repl2. Signed-off-by: Florence Blanc-Renaud Reviewed-By: Anuja More --- diff --git a/ipatests/test_integration/test_topology.py b/ipatests/test_integration/test_topology.py index 8a240fa..618c9d5 100644 --- a/ipatests/test_integration/test_topology.py +++ b/ipatests/test_integration/test_topology.py @@ -124,6 +124,9 @@ class TestTopologyOptions(IntegrationTest): self.replicas[0], self.replicas[1]) assert err == "", err + # At this point we have replicas[1] <-> master <-> replicas[0] + # ^--------------------------^ + # Make sure the new segment is shown by `ipa topologysegment-find` result1 = self.master.run_command(['ipa', 'topologysegment-find', DOMAIN_SUFFIX_NAME]).stdout_text @@ -137,9 +140,12 @@ class TestTopologyOptions(IntegrationTest): deleteme = find_segment(self.master, self.replicas[1]) returncode, error = tasks.destroy_segment(self.master, deleteme) assert returncode == 0, error + # At this point we have master <-> replicas[0] <-> replicas[1] + # Wait till replication ends and make sure replica1 does not have # segment that was deleted on master master_ldap = self.master.ldap_connect() + repl_ldap = self.replicas[0].ldap_connect() tasks.wait_for_replication(master_ldap) result3 = self.replicas[0].run_command(['ipa', 'topologysegment-find', DOMAIN_SUFFIX_NAME]).stdout_text @@ -150,6 +156,7 @@ class TestTopologyOptions(IntegrationTest): '--first', 'test', '--last', 'user']) tasks.wait_for_replication(master_ldap) + tasks.wait_for_replication(repl_ldap) result4 = self.replicas[1].run_command(['ipa', 'user-find']) assert('someuser' in result4.stdout_text), 'User not found: someuser' # We end up having a line topology: master <-> replica1 <-> replica2