summaryrefslogtreecommitdiff
path: root/test/test_failover_integration.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2015-06-04 22:10:21 -0700
committerDana Powers <dana.powers@rd.io>2015-06-06 16:22:27 -0700
commit207499b26d5ce6c7a72771250b8e4365944aa1bd (patch)
treedaa38905d6a547ca9e4679253b4fc3c664199866 /test/test_failover_integration.py
parent868115c703afc4403adc8d9481bf31d2c15064dd (diff)
downloadkafka-python-207499b26d5ce6c7a72771250b8e4365944aa1bd.tar.gz
random_string helper should return str not bytes
Diffstat (limited to 'test/test_failover_integration.py')
-rw-r--r--test/test_failover_integration.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_failover_integration.py b/test/test_failover_integration.py
index 3be0189..11e255d 100644
--- a/test/test_failover_integration.py
+++ b/test/test_failover_integration.py
@@ -133,8 +133,8 @@ class TestFailover(KafkaIntegrationTestCase):
# Send 10 random messages
for _ in range(10):
- key = random_string(3)
- msg = random_string(10)
+ key = random_string(3).encode('utf-8')
+ msg = random_string(10).encode('utf-8')
producer.send_messages(topic, key, msg)
# kill leader for partition 0
@@ -145,8 +145,8 @@ class TestFailover(KafkaIntegrationTestCase):
timeout = 60
while not recovered and (time.time() - started) < timeout:
try:
- key = random_string(3)
- msg = random_string(10)
+ key = random_string(3).encode('utf-8')
+ msg = random_string(10).encode('utf-8')
producer.send_messages(topic, key, msg)
if producer.partitioners[kafka_bytestring(topic)].partition(key) == 0:
recovered = True
@@ -159,15 +159,15 @@ class TestFailover(KafkaIntegrationTestCase):
# send some more messages just to make sure no more exceptions
for _ in range(10):
- key = random_string(3)
- msg = random_string(10)
+ key = random_string(3).encode('utf-8')
+ msg = random_string(10).encode('utf-8')
producer.send_messages(topic, key, msg)
def _send_random_messages(self, producer, topic, partition, n):
for j in range(n):
logging.debug('_send_random_message to %s:%d -- try %d', topic, partition, j)
- resp = producer.send_messages(topic, partition, random_string(10))
+ resp = producer.send_messages(topic, partition, random_string(10).encode('utf-8'))
if len(resp) > 0:
self.assertEqual(resp[0].error, 0)
logging.debug('_send_random_message to %s:%d -- try %d success', topic, partition, j)