Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More cautious testing in test_terminate_when_waiting

  • Loading branch information...
commit a4393185fc4772b291355726958dd96fcb8870f1 1 parent 4174426
@oldpatricka oldpatricka authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 epu/processdispatcher/test/test_processdispatcher_service.py
View
26 epu/processdispatcher/test/test_processdispatcher_service.py
@@ -165,6 +165,28 @@ def _wait_assert_pd_dump(self, fun, *args, **kwargs):
return
time.sleep(0.05)
+ def _wait_for_one_reconfigure(self, domain_id=None,):
+ tries = 0
+ while True:
+ if domain_id is not None:
+ reconfigures = self.epum_client.reconfigures[domain_id]
+ else:
+ reconfigures = self.epum_client.reconfigures.values()
+ self.assertTrue(reconfigures)
+ reconfigures = reconfigures[0]
+
+ try:
+ self.assertEqual(len(reconfigures), 1)
+ except Exception:
+ tries += 1
+ if tries == self.max_tries:
+ log.error("Waiting for reconfigure failing after %d attempts",
+ tries)
+ raise
+ else:
+ return
+ time.sleep(0.5)
+
def test_basics(self):
# create some fake nodes and tell PD about them
@@ -237,6 +259,7 @@ def test_terminate_when_waiting(self):
"""
domain_id = domain_id_from_engine("engine2")
+ self._wait_for_one_reconfigure(domain_id)
self.assert_one_reconfigure(domain_id, 0, [])
self.epum_client.clear()
@@ -250,7 +273,7 @@ def test_terminate_when_waiting(self):
self._wait_assert_pd_dump(self._assert_process_distribution,
queued=procs)
- print self.epum_client.reconfigures
+ self._wait_for_one_reconfigure(domain_id)
self.assert_one_reconfigure(domain_id, 1, [])
self.epum_client.clear()
@@ -272,6 +295,7 @@ def test_terminate_when_waiting(self):
self._wait_assert_pd_dump(self._assert_process_distribution,
queued=[])
+ self._wait_for_one_reconfigure(domain_id)
self.assert_one_reconfigure(domain_id, 0, [])
self.epum_client.clear()
Please sign in to comment.
Something went wrong with that request. Please try again.