#NEWLINE# def test_service_disconnect_with_active_rpc_worker_via_service_proxy( logger , container_factory , rabbit_manager , rabbit_config ) : #NEWLINE# #INDENT# " Break the connection between a service's queue consumer and rabbit\n    while the service has an active rpc worker (i.e. response required).\n\n    Make the rpc call from a nameko service. We expect the service to see\n    the duplicate response and discard it.\n    " #NEWLINE# proxy_container = container_factory ( ProxyService , service_container ) #NEWLINE# service_container = container_factory ( ExampleService , rabbit_config ) #NEWLINE# service_container . start ( ) #NEWLINE# vhost = rabbit_config [ 'vhost' ] #NEWLINE# connections = get_rabbit_connections ( vhost , rabbit_manager ) #NEWLINE# assert ( len ( connections ) == 1 ) #NEWLINE# service_consumer_conn = connections [ 0 ] [ 'name' ] #NEWLINE# proxy_container . start ( ) #NEWLINE# connections = get_rabbit_connections ( vhost , rabbit_manager ) #NEWLINE# assert ( len ( connections ) == 2 ) #NEWLINE# eventlet . spawn ( disconnect_on_event , rabbit_manager , service_consumer_conn ) #NEWLINE# arg = uuid . uuid4 ( ) . hex #NEWLINE# with entrypoint_hook ( proxy_container , 'entrypoint' ) as entrypoint : #NEWLINE# #INDENT# assert ( entrypoint ( arg ) == arg ) #NEWLINE# #UNINDENT# def duplicate_response_received( ) : #NEWLINE# #INDENT# correlation_warning = call ( 'Unknown correlation id: %s' , ANY ) #NEWLINE# assert ( correlation_warning in logger . debug . call_args_list ) #NEWLINE# #UNINDENT# assert_stops_raising ( duplicate_response_received ) #NEWLINE# def method_called_twice( ) : #NEWLINE# #INDENT# assert ( method_called . call_args_list == [ call ( arg ) , call ( arg ) ] ) #NEWLINE# #UNINDENT# assert_stops_raising ( method_called_twice ) #NEWLINE# connections = get_rabbit_connections ( vhost , rabbit_manager ) #NEWLINE# assert ( service_consumer_conn not in [ conn [ 'name' ] for conn in connections ] )