The "simple replication" test is failing intermittently. It's quite hard to manually verify if this patch fixes that completely, but my testing says it does make a positive difference.

See commit message for details.

--
PetrĀ³
From 71ae0f8529dbf60127ee56073aee9ddb16435933 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Wed, 4 Sep 2013 13:44:57 +0200
Subject: [PATCH] test_simple_replication: Fix waiting for replication

The integration tests must wait for replication to happen before checking
results. In some cases, the tests have failed because the checks that
detect completed replication were insufficient.

This fixes the code to:
- Wait for replication to be completed on both servers
- In the case of an error, continue waiting -- it might be the case that
  the DS is temporarily unreachable
---
 ipatests/test_integration/tasks.py                   | 3 +--
 ipatests/test_integration/test_simple_replication.py | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 69a34a2871204405ade745b12e1afe7e80f98a29..d1ada4b419a1952525e97aca311bd425809292aa 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -419,8 +419,7 @@ def wait_for_replication(ldap, timeout=30):
         if any(not e.single_value(status_attr).startswith('0 ')
                for e in entries):
             log.error('Replication error')
-            break
-        in_progress = []
+            continue
         if any(e.single_value(progress_attr) == 'TRUE' for e in entries):
             log.debug('Replication in progress (waited %s/%ss)',
                       i, timeout)
diff --git a/ipatests/test_integration/test_simple_replication.py b/ipatests/test_integration/test_simple_replication.py
index 998b1196a24ef52b88ab4a6248cdc2d1f808677d..f1da22f50d6d443bf058c903f586a2989e328b93 100644
--- a/ipatests/test_integration/test_simple_replication.py
+++ b/ipatests/test_integration/test_simple_replication.py
@@ -36,6 +36,9 @@ def check_replication(self, source_host, dest_host, login):
                                  '--first', 'test',
                                  '--last', 'user'])
 
+        source_ldap = source_host.ldap_connect()
+        tasks.wait_for_replication(source_ldap)
+
         ldap = dest_host.ldap_connect()
         tasks.wait_for_replication(ldap)
 
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to