From da65a562bdd9ce20290d4375acc36b4977ef7026 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Thu, 11 Jan 2018 14:48:38 -0800 Subject: Fix coordinator join_future race condition (#1338) * Fix race condition in coordinator join_future handling --- test/test_coordinator.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/test_coordinator.py') diff --git a/test/test_coordinator.py b/test/test_coordinator.py index 7dc0e04..f567369 100644 --- a/test/test_coordinator.py +++ b/test/test_coordinator.py @@ -620,3 +620,16 @@ def test_lookup_coordinator_failure(mocker, coordinator): return_value=Future().failure(Exception('foobar'))) future = coordinator.lookup_coordinator() assert future.failed() + + +def test_ensure_active_group(mocker, coordinator): + coordinator._subscription.subscribe(topics=['foobar']) + mocker.patch.object(coordinator, 'coordinator_unknown', return_value=False) + mocker.patch.object(coordinator, '_send_join_group_request', return_value=Future().success(True)) + mocker.patch.object(coordinator, 'need_rejoin', side_effect=[True, True, False]) + mocker.patch.object(coordinator, '_on_join_complete') + mocker.patch.object(coordinator, '_heartbeat_thread') + + coordinator.ensure_active_group() + + coordinator._send_join_group_request.assert_called_once_with() -- cgit v1.2.1