From 5ced9be0be78cc575dc41a948cb6b54eee680028 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Mon, 2 Sep 2019 08:58:44 -0400 Subject: [PATCH] Add reconnect logic test. --- tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests.py b/tests.py index 80c7a1f..19b89be 100644 --- a/tests.py +++ b/tests.py @@ -155,6 +155,13 @@ class TCPStatsdMetricCollectionTests(testing.AsyncHTTPTestCase): self.assertEqual(expected, list(self.statsd.find_metrics(expected, 'ms'))[0][0]) + def test_reconnect_logic(self): + self.application.statsd._tcp_reconnect_sleep = 0.05 + self.application.statsd._sock.close() + asyncio.get_event_loop().run_until_complete(asyncio.sleep(0.075)) + response = self.fetch('/status_code') + self.assertEqual(response.code, 200) + class TCPStatsdConfigurationTests(testing.AsyncHTTPTestCase):