Fixed test test_heart_beat_timeout
This commit is contained in:
@@ -85,7 +85,10 @@ class TestHostListener(HostStateListener):
|
|||||||
host_down = None
|
host_down = None
|
||||||
|
|
||||||
def on_down(self, host):
|
def on_down(self, host):
|
||||||
host_down = host
|
self.host_down = True
|
||||||
|
|
||||||
|
def on_up(self, host):
|
||||||
|
self.host_down = False
|
||||||
|
|
||||||
|
|
||||||
class HeartbeatTest(unittest.TestCase):
|
class HeartbeatTest(unittest.TestCase):
|
||||||
@@ -94,7 +97,8 @@ class HeartbeatTest(unittest.TestCase):
|
|||||||
|
|
||||||
@since 3.3
|
@since 3.3
|
||||||
@jira_ticket PYTHON-286
|
@jira_ticket PYTHON-286
|
||||||
@expected_result host should not be marked down when heartbeat fails
|
@expected_result host should be marked down when heartbeat fails. This
|
||||||
|
happens after PYTHON-734
|
||||||
|
|
||||||
@test_category connection heartbeat
|
@test_category connection heartbeat
|
||||||
"""
|
"""
|
||||||
@@ -120,6 +124,7 @@ class HeartbeatTest(unittest.TestCase):
|
|||||||
node.pause()
|
node.pause()
|
||||||
# Wait for connections associated with this host go away
|
# Wait for connections associated with this host go away
|
||||||
self.wait_for_no_connections(host, self.cluster)
|
self.wait_for_no_connections(host, self.cluster)
|
||||||
|
self.assertTrue(test_listener.host_down)
|
||||||
# Resume paused node
|
# Resume paused node
|
||||||
finally:
|
finally:
|
||||||
node.resume()
|
node.resume()
|
||||||
@@ -134,7 +139,7 @@ class HeartbeatTest(unittest.TestCase):
|
|||||||
time.sleep(.1)
|
time.sleep(.1)
|
||||||
self.assertLess(count, 100, "Never connected to the first node")
|
self.assertLess(count, 100, "Never connected to the first node")
|
||||||
new_connections = self.wait_for_connections(host, self.cluster)
|
new_connections = self.wait_for_connections(host, self.cluster)
|
||||||
self.assertIsNone(test_listener.host_down)
|
self.assertFalse(test_listener.host_down)
|
||||||
# Make sure underlying new connections don't match previous ones
|
# Make sure underlying new connections don't match previous ones
|
||||||
for connection in initial_connections:
|
for connection in initial_connections:
|
||||||
self.assertFalse(connection in new_connections)
|
self.assertFalse(connection in new_connections)
|
||||||
|
|||||||
Reference in New Issue
Block a user