Hi everyone,

This patch fixes a hang of integration tests upon a failure to start slapd
(which is a separate issue), introduced by my misunderstanding of Python.

Nick
>From a9cd92dd91e8475911cc64d29f64befb3b4b7ee4 Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <[email protected]>
Date: Fri, 9 Oct 2015 18:05:07 +0300
Subject: [PATCH] intg: Do not use non-existent pre-increment

Do not try to use the pre-increment operator which doesn't exist in
Python (and is in fact two "identity" operators - opposites of
"negation" operators). Use addition and assignment instead.

This fixes infinite loops on failed slapd starting and stopping.
---
 src/tests/intg/ds_openldap.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/tests/intg/ds_openldap.py b/src/tests/intg/ds_openldap.py
index 2ece0cf..ba7fde6 100644
--- a/src/tests/intg/ds_openldap.py
+++ b/src/tests/intg/ds_openldap.py
@@ -217,7 +217,8 @@ class DSOpenLDAP(DS):
                 break
             except ldap.SERVER_DOWN:
                 pass
-            if ++attempt > 30:
+            attempt = attempt + 1
+            if attempt > 30:
                 raise Exception("Failed to start slapd")
             time.sleep(1)
 
@@ -270,7 +271,8 @@ class DSOpenLDAP(DS):
                 pid_file.close()
             attempt = 0
             while os.path.isfile(self.pid_path):
-                if ++attempt > 30:
+                attempt = attempt + 1
+                if attempt > 30:
                     raise Exception("Failed to stop slapd")
                 time.sleep(1)
         except IOError as e:
-- 
2.6.1

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to