From abaec3c8cc7cfe11eb09d9167a0f093875aa6a37 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Thu, 5 Jan 2012 17:25:18 -0500 Subject: [PATCH] Ensure all servers are up for later tests, even if test_3x5_reconnects fails. --- brod/test/test_zk.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/brod/test/test_zk.py b/brod/test/test_zk.py index 74c8049..22930f7 100644 --- a/brod/test/test_zk.py +++ b/brod/test/test_zk.py @@ -115,6 +115,9 @@ def __init__(self, kafka_config): self.process = None def start(self): + if self.process: + return + env = os.environ.copy() env["JMX_PORT"] = str(self.kafka_config.jmx_port) log.info("SETUP: Starting Kafka with config {0}".format(self.kafka_config)) @@ -400,7 +403,10 @@ def test_3x5_zookeeper_invalid_offset(): assert result for msg_set in result: assert_equals(msg_set.messages, ["world"]) - + +# Make sure that even if the test fails, the instance we brought down starts +# back up. +@with_setup(teardown=lambda: RunConfig.kafka_servers[0].start()) def test_3x5_reconnects(): """Test that we keep trying to read, even if our brokers go down. @@ -469,6 +475,8 @@ def test_3x5_reconnects(): assert_equal(topology_3x5.partitions_per_broker, len([msg_set for msg_set in result if msg_set.messages == ["Jack"]])) + +