From d5c05c811e453c507ac6f7f85bceffc5a7ba1661 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Tue, 16 Feb 2016 12:32:29 -0800 Subject: Make sure all consumers are in same generation before stopping group test --- test/test_consumer_group.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test_consumer_group.py b/test/test_consumer_group.py index 03656fa..6ef2020 100644 --- a/test/test_consumer_group.py +++ b/test/test_consumer_group.py @@ -76,10 +76,23 @@ def test_group(kafka_broker, topic): timeout = time.time() + 35 while True: for c in range(num_consumers): + + # Verify all consumers have been created if c not in consumers: break + + # Verify all consumers have an assignment elif not consumers[c].assignment(): break + + # Verify all consumers are in the same generation + generations = set() + for consumer in six.itervalues(consumers): + generations.add(consumer._coordinator.generation) + if len(generations) != 1: + break + + # If all checks passed, log state and break while loop else: for c in range(num_consumers): logging.info("[%s] %s %s: %s", c, -- cgit v1.2.1