summaryrefslogtreecommitdiff
path: root/test/fixtures.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-03-13 23:16:17 -0700
committerDana Powers <dana.powers@gmail.com>2016-03-13 23:19:43 -0700
commita45cd4d17bd7f6d1fe9ae887f5847182a799ca07 (patch)
tree6f07f8bc1ad5d38853d38be63323dd0c606718a9 /test/fixtures.py
parentbd5bd62b09425140cf53a7fb61c56b88ce19ab96 (diff)
downloadkafka-python-a45cd4d17bd7f6d1fe9ae887f5847182a799ca07.tar.gz
Improve Fixture logging
- remove double console appenders from log4j.properties - also log to server.log file for interactive uses - drop internal _spawn from SpawnedService loop - write captured stdout/stderr directly to avoid logger re-formatting
Diffstat (limited to 'test/fixtures.py')
-rw-r--r--test/fixtures.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/fixtures.py b/test/fixtures.py
index 7da4f52..9375932 100644
--- a/test/fixtures.py
+++ b/test/fixtures.py
@@ -72,10 +72,10 @@ class Fixture(object):
result.extend(args)
return result
- @classmethod
- def kafka_run_class_env(cls):
+ def kafka_run_class_env(self):
env = os.environ.copy()
- env['KAFKA_LOG4J_OPTS'] = "-Dlog4j.configuration=file:%s" % cls.test_resource("log4j.properties")
+ env['LOG_DIR'] = os.path.join(self.tmp_dir, 'logs')
+ env['KAFKA_LOG4J_OPTS'] = "-Dlog4j.configuration=file:%s" % self.test_resource("log4j.properties")
return env
@classmethod
@@ -141,11 +141,13 @@ class ZookeeperFixture(Fixture):
backoff = 1
end_at = time.time() + max_timeout
while time.time() < end_at:
+ log.critical('Starting Zookeeper instance')
self.child = SpawnedService(args, env)
self.child.start()
timeout = min(timeout, max(end_at - time.time(), 0))
if self.child.wait_for(r"binding to port", timeout=timeout):
break
+ log.critical('Zookeeper did not start within timeout %s secs', timeout)
self.child.stop()
timeout *= 2
time.sleep(backoff)
@@ -260,12 +262,14 @@ class KafkaFixture(Fixture):
backoff = 1
end_at = time.time() + max_timeout
while time.time() < end_at:
+ log.critical('Starting Kafka instance')
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):
break
+ log.critical('Kafka did not start within timeout %s secs', timeout)
self.child.stop()
timeout *= 2
time.sleep(backoff)