summaryrefslogtreecommitdiff
path: root/test/fixtures.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2017-10-23 21:43:53 -0700
committerGitHub <noreply@github.com>2017-10-23 21:43:53 -0700
commite06af5343a55cf8d03e32a645ee970d872cb9ba0 (patch)
tree2435e803cc7f37a1552eba071e4e588ebfa34c18 /test/fixtures.py
parenta345dcd2ca1b0f8934864c512a4a78c65034dd36 (diff)
downloadkafka-python-e06af5343a55cf8d03e32a645ee970d872cb9ba0.tar.gz
Add fixture support for upcoming 1.0.0 broker release (#1275)
Diffstat (limited to 'test/fixtures.py')
-rw-r--r--test/fixtures.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/fixtures.py b/test/fixtures.py
index c131f5a..62a1980 100644
--- a/test/fixtures.py
+++ b/test/fixtures.py
@@ -223,6 +223,11 @@ class KafkaFixture(Fixture):
self.transport = transport.upper()
self.ssl_dir = self.test_resource('ssl')
+ # TODO: checking for port connection would be better than scanning logs
+ # until then, we need the pattern to work across all supported broker versions
+ # The logging format changed slightly in 1.0.0
+ self.start_pattern = r"\[Kafka ?Server (id=)?%d\],? started" % broker_id
+
self.zk_host = zk_host
self.zk_port = zk_port
self.zk_chroot = zk_chroot
@@ -303,8 +308,7 @@ class KafkaFixture(Fixture):
self.child = SpawnedService(args, env)
self.child.start()
timeout = min(timeout, max(end_at - time.time(), 0))
- if self.child.wait_for(r"\[Kafka Server %d\], Started" %
- self.broker_id, timeout=timeout):
+ if self.child.wait_for(self.start_pattern, timeout=timeout):
break
self.child.dump_logs()
self.child.stop()