diff options
author | Dana Powers <dana.powers@rd.io> | 2015-03-29 18:52:12 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@rd.io> | 2015-03-29 18:52:12 -0700 |
commit | 1313388662d509ade01f71d0740cd0efe263c01f (patch) | |
tree | d6ce3461fafa1f92c827bb682c3be4c93d3cff0e /test/test_client.py | |
parent | a4b439141b2ef35951e46716696e4c01bb88661c (diff) | |
download | kafka-python-1313388662d509ade01f71d0740cd0efe263c01f.tar.gz |
Add test for correlation_id rollover
Diffstat (limited to 'test/test_client.py')
-rw-r--r-- | test/test_client.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_client.py b/test/test_client.py index c522d9a..abda421 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -401,3 +401,11 @@ class TestKafkaClient(unittest.TestCase): with self.assertRaises(ConnectionError): KafkaConnection("nowhere", 1234, 1.0) self.assertGreaterEqual(t.interval, 1.0) + + def test_correlation_rollover(self): + with patch.object(KafkaClient, 'load_metadata_for_topics'): + big_num = 2**31 - 3 + client = KafkaClient(hosts=[], correlation_id=big_num) + self.assertEqual(big_num + 1, client._next_id()) + self.assertEqual(big_num + 2, client._next_id()) + self.assertEqual(0, client._next_id()) |