summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2020-09-24 11:41:11 +0300
committerMichael Klishin <michael@clojurewerkz.org>2020-09-24 11:41:11 +0300
commit17ef8504f878142c8756a15ef1a1fa072311a7ba (patch)
tree010e04b8bde697673459262b3a379897414880be
parentb5cc2414a021b8fe5f91fb6494e1be3fe0f35a9b (diff)
downloadrabbitmq-server-git-17ef8504f878142c8756a15ef1a1fa072311a7ba.tar.gz
Make it easy to close all connections on a node
from a test. HTTP API test suites would greatly benefit from this.
-rw-r--r--src/rabbit_networking.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index e0041e619f..8ef569034d 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -27,7 +27,7 @@
connection_info/1, connection_info/2,
connection_info_all/0, connection_info_all/1,
emit_connection_info_all/4, emit_connection_info_local/3,
- close_connection/2, close_connections/2,
+ close_connection/2, close_connections/2, close_all_connections/1,
force_connection_event_refresh/1, handshake/2, tcp_host/1,
ranch_ref/1, ranch_ref/2, ranch_ref_of_protocol/1,
listener_of_protocol/1, stop_ranch_listener_of_protocol/1]).
@@ -449,6 +449,13 @@ close_connections(Pids, Explanation) ->
[close_connection(Pid, Explanation) || Pid <- Pids],
ok.
+%% Meant to be used by tests only
+-spec close_all_connections(string()) -> 'ok'.
+close_all_connections(Explanation) ->
+ Pids = connections(),
+ [close_connection(Pid, Explanation) || Pid <- Pids],
+ ok.
+
-spec force_connection_event_refresh(reference()) -> 'ok'.
force_connection_event_refresh(Ref) ->
[rabbit_reader:force_event_refresh(C, Ref) || C <- connections()],