@@ -455,6 +455,34 @@ def test_stale_control_connection_failure_is_endpoint_fenced(self):
455455 host , self .connection .last_error , is_host_addition = False ,
456456 expected_endpoint = old_endpoint )
457457
458+ def test_stale_control_connection_failure_reconnects_when_cluster_ignores_signal (self ):
459+ host_id = uuid .uuid4 ()
460+ old_endpoint = ClientRoutesEndPoint (
461+ host_id , Mock (), "127.0.0.1" , original_port = 9042 )
462+ new_endpoint = ClientRoutesEndPoint (
463+ host_id , Mock (), "127.0.0.1" , original_port = 9142 )
464+
465+ host = Host (old_endpoint , SimpleConvictionPolicy , host_id = host_id )
466+ host .set_up ()
467+ self .cluster .metadata = Metadata ()
468+ self .cluster .metadata .add_or_return_host (host )
469+ host .endpoint = new_endpoint
470+ self .cluster .metadata .update_host (host , old_endpoint )
471+
472+ self .connection .endpoint = old_endpoint
473+ self .connection .is_defunct = True
474+ self .connection .last_error = ConnectionException (
475+ "stale control connection failed" , endpoint = old_endpoint )
476+ self .cluster .signal_connection_failure = Mock (return_value = False )
477+ self .control_connection .reconnect = Mock ()
478+
479+ self .control_connection ._signal_error ()
480+
481+ self .cluster .signal_connection_failure .assert_called_once_with (
482+ host , self .connection .last_error , is_host_addition = False ,
483+ expected_endpoint = old_endpoint )
484+ self .control_connection .reconnect .assert_called_once_with ()
485+
458486 def test_refresh_nodes_and_tokens_uses_preloaded_results_if_given (self ):
459487 """
460488 refresh_nodes_and_tokens uses preloaded results if given for shared table queries
0 commit comments