From e1c232bd515b678524c1b6ae7b2cc6c4af72f9b9 Mon Sep 17 00:00:00 2001 From: David LaBissoniere Date: Wed, 19 Dec 2012 14:35:20 -0600 Subject: [PATCH] Fix tests --- .../test/test_highavailability_service.py | 14 ++++---------- .../test/test_processdispatcher_service.py | 2 +- epu/provisioner/test/util.py | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/epu/highavailability/test/test_highavailability_service.py b/epu/highavailability/test/test_highavailability_service.py index 788feebf..4259d651 100644 --- a/epu/highavailability/test/test_highavailability_service.py +++ b/epu/highavailability/test/test_highavailability_service.py @@ -84,6 +84,7 @@ logfile: /tmp/eeagent_nodetwo.log """ + class HighAvailabilityServiceMixin(unittest.TestCase): def _update_policy_params_and_assert(self, new_params, maxattempts=None): @@ -192,7 +193,6 @@ def _assert_n_processes(self, n, timeout=None, only_pd=None): assert False, "HA took more than %ss to get to %s processes. Had %s" % (timeout, n, processes) - class HighAvailabilityServiceTests(HighAvailabilityServiceMixin, TestFixture): def setUp(self): @@ -217,10 +217,7 @@ def setUp(self): self.epuharness.start(deployment_str=deployment) - # Ensure that all of the PDs are up - for pd in self.pd_names: - pd_client = ProcessDispatcherClient(self.dashi, pd) - pd_client.dump() + self.block_until_ready(deployment, self.dashi) self.haservice = HighAvailabilityService(policy_parameters=policy_params, process_dispatchers=self.pd_names, exchange=self.exchange, @@ -334,6 +331,7 @@ def test_missing_proc(self): self._assert_n_processes(n) print self._get_all_procs() + class HighAvailabilityServiceOnePDTests(HighAvailabilityServiceMixin, TestFixture): def setUp(self): @@ -360,11 +358,7 @@ def setUp(self): self.addCleanup(self.cleanup_harness) self.epuharness.start(deployment_str=deployment_one_pd_two_eea) - - # Ensure that all of the PDs are up - for pd in self.pd_names: - pd_client = ProcessDispatcherClient(self.dashi, pd) - pd_client.dump() + self.block_until_ready(deployment, self.dashi) self.haservice = HighAvailabilityService(policy_parameters=policy_params, process_dispatchers=self.pd_names, exchange=self.exchange, diff --git a/epu/processdispatcher/test/test_processdispatcher_service.py b/epu/processdispatcher/test/test_processdispatcher_service.py index 5487eed2..8ffc3f37 100644 --- a/epu/processdispatcher/test/test_processdispatcher_service.py +++ b/epu/processdispatcher/test/test_processdispatcher_service.py @@ -67,7 +67,7 @@ def setup_store(self): return ProcessDispatcherStore() def teardown_store(self): - return + self.store.shutdown() def _spawn_eeagent(self, node_id, slot_count, heartbeat_dest=None): if heartbeat_dest is None: diff --git a/epu/provisioner/test/util.py b/epu/provisioner/test/util.py index c96b3b3e..cd877136 100644 --- a/epu/provisioner/test/util.py +++ b/epu/provisioner/test/util.py @@ -86,12 +86,12 @@ def _send_record_internal(self, record, subscribers): log.debug('Got updated state record for node %s: %s -> %s', node_id, old_state, state) else: - log.debug('Got out-of-order record for node %s. %s -> %s', + log.debug('Got out-of-order record for node %s. %s -> %s', node_id, old_state, state) else: self.nodes[node_id] = record self.nodes_rec_count[node_id] = 1 - log.debug('Recorded new state record for node %s: %s', + log.debug('Recorded new state record for node %s: %s', node_id, state) if subscribers: @@ -153,7 +153,7 @@ def assure_subscribers(self, node_id, subscribers): return True def wait_for_state(self, state, nodes=None, - before=None, before_kwargs=None, timeout=10): + before=None, before_kwargs=None, timeout=30): import time if before_kwargs is None: