URL: https://github.com/freeipa/freeipa/pull/424
Author: MartinBasti
 Title: #424: Tests: fix wait_for_replication task
Action: opened

PR body:
"""
DS changed a format of replication status attribute. Now it is with
prefix "Error (x)" where x is the error code.

Both formats were kept to allow tests run on older and new
versions of DS.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/424/head:pr424
git checkout pr424
From ade8a8fc9f98c91b53ab2944b6e2a6d79fbdddb3 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 31 Jan 2017 09:19:22 +0100
Subject: [PATCH] Tests: fix wait_for_replication task

DS changed a format of replication status attribute. Now it is with
prefix "Error (x)" where x is the error code.

Both formats were kept to allow tests run on older and new
versions of DS.
---
 ipatests/test_integration/tasks.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 5a9d526..f6fa451 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -1067,8 +1067,15 @@ def wait_for_replication(ldap, timeout=30):
             filter='(objectclass=nsds5replicationagreement)',
             attrs_list=[status_attr, progress_attr])
         log.debug('Replication agreements: \n%s', _entries_to_ldif(entries))
-        if any(not e.single_value[status_attr].startswith('0 ')
-               for e in entries):
+        if any(
+                not (
+                    # older DS format
+                    e.single_value[status_attr].startswith('0 ') or
+                    # newer DS format
+                    e.single_value[status_attr].startswith('Error (0) ')
+                )
+            for e in entries
+        ):
             log.error('Replication error')
             continue
         if any(e.single_value[progress_attr] == 'TRUE' for e in entries):
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to