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
This commit is contained in:
Petr Viktorin 2013-09-04 13:44:57 +02:00
parent 756b997a7d
commit f34b8896f9
2 changed files with 4 additions and 2 deletions

View File

@ -419,8 +419,7 @@ def wait_for_replication(ldap, timeout=30):
if any(not e.single_value(status_attr).startswith('0 ') if any(not e.single_value(status_attr).startswith('0 ')
for e in entries): for e in entries):
log.error('Replication error') log.error('Replication error')
break continue
in_progress = []
if any(e.single_value(progress_attr) == 'TRUE' for e in entries): if any(e.single_value(progress_attr) == 'TRUE' for e in entries):
log.debug('Replication in progress (waited %s/%ss)', log.debug('Replication in progress (waited %s/%ss)',
i, timeout) i, timeout)

View File

@ -36,6 +36,9 @@ class TestSimpleReplication(IntegrationTest):
'--first', 'test', '--first', 'test',
'--last', 'user']) '--last', 'user'])
source_ldap = source_host.ldap_connect()
tasks.wait_for_replication(source_ldap)
ldap = dest_host.ldap_connect() ldap = dest_host.ldap_connect()
tasks.wait_for_replication(ldap) tasks.wait_for_replication(ldap)