summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-05-06 18:53:29 +0000
committerAlan Conway <aconway@apache.org>2010-05-06 18:53:29 +0000
commit5bee9733abc18405f6e4f8e059e7fd1487b5ae38 (patch)
tree795db232ebe1ef2dfaf8088cfd793dbaa417332a
parent041f826462375ae24c0c0feec603b8f6b33453fe (diff)
downloadqpid-python-5bee9733abc18405f6e4f8e059e7fd1487b5ae38.tar.gz
Correct brokertest.retry logic.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@941852 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/cluster/Cluster.cpp2
-rw-r--r--qpid/cpp/src/tests/Makefile.am2
-rw-r--r--qpid/python/qpid/brokertest.py8
3 files changed, 6 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/cluster/Cluster.cpp b/qpid/cpp/src/qpid/cluster/Cluster.cpp
index a5581cff5e..c3d83cfcac 100644
--- a/qpid/cpp/src/qpid/cluster/Cluster.cpp
+++ b/qpid/cpp/src/qpid/cluster/Cluster.cpp
@@ -965,7 +965,7 @@ void Cluster::memberUpdate(Lock& l) {
// Mark store clean if I am the only broker, dirty otherwise.
if (size == 1 ) {
if (store.getState() != STORE_STATE_CLEAN_STORE) {
- QPID_LOG(notice, "Sole member of cluster, marking store clean.");
+ QPID_LOG(notice, *this << "Sole member of cluster, marking store clean.");
store.clean(Uuid(true));
}
}
diff --git a/qpid/cpp/src/tests/Makefile.am b/qpid/cpp/src/tests/Makefile.am
index 1faed16173..6133fc2e49 100644
--- a/qpid/cpp/src/tests/Makefile.am
+++ b/qpid/cpp/src/tests/Makefile.am
@@ -370,7 +370,7 @@ EXTRA_DIST+= \
check-long:
$(MAKE) check TESTS="$(LONG_TESTS)" VALGRIND=
-check: python_prep
+check: python_prep test_env.sh
PYTHON_SRC_DIR=$(abs_srcdir)/../../../python
PYTHON_BLD_DIR=$(abs_builddir)/python
diff --git a/qpid/python/qpid/brokertest.py b/qpid/python/qpid/brokertest.py
index e05a172ab4..f78dcf4c35 100644
--- a/qpid/python/qpid/brokertest.py
+++ b/qpid/python/qpid/brokertest.py
@@ -94,12 +94,12 @@ def retry(function, timeout=5, delay=.01):
"""Call function until it returns True or timeout expires.
Double the delay for each retry. Return True if function
returns true, False if timeout expires."""
- elapsed = 0
while not function():
- elapsed += delay
- if elapsed > timeout: return False
- delay *= 2
+ if delay > timeout: delay = timeout
time.sleep(delay)
+ timeout -= delay
+ if timeout <= 0: return False
+ delay *= 2
return True
class Popen(popen2.Popen3):