Skip to content

Commit

Permalink
Rename disconnect_node_by_name to disconnect_node_by_id
Browse files Browse the repository at this point in the history
  • Loading branch information
arcusfelis committed May 16, 2024
1 parent 0209ac8 commit 06d99a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/cets_disco_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
block_node/2,
reconnect_node/2,
disconnect_node/2,
disconnect_node_by_name/2
disconnect_node_by_id/2
]).

-import(cets_test_rpc, [
Expand Down Expand Up @@ -636,7 +636,7 @@ disco_nodeup_timestamp_is_updated_after_node_reconnects(Config) ->
Setup = setup_two_nodes_and_discovery(Config, [wait, disco2]),
#{disco := Disco, node2 := Node2} = Setup,
OldTimestamp = cets_test_helper:get_disco_timestamp(Disco, nodeup_timestamps, Node2),
disconnect_node_by_name(Config, ct2),
disconnect_node_by_id(Config, ct2),
wait_for_disco_timestamp_to_be_updated(Disco, nodeup_timestamps, Node2, OldTimestamp).

disco_node_start_timestamp_is_updated_after_node_restarts(Config) ->
Expand Down
12 changes: 6 additions & 6 deletions test/cets_test_peer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
block_node/2,
reconnect_node/2,
disconnect_node/2,
disconnect_node_by_name/2
disconnect_node_by_id/2
]).

-import(cets_test_rpc, [rpc/4]).

-include_lib("common_test/include/ct.hrl").

start(Names, Config) ->
{Nodes, Peers} = lists:unzip([find_or_start_node(N) || N <- Names]),
start(Ids, Config) ->
{Nodes, Peers} = lists:unzip([find_or_start_node(Id) || Id <- Ids]),
[
{nodes, maps:from_list(lists:zip(Names, Nodes))},
{peers, maps:from_list(lists:zip(Names, Peers))}
{nodes, maps:from_list(lists:zip(Ids, Nodes))},
{peers, maps:from_list(lists:zip(Ids, Peers))}
| Config
].

Expand Down Expand Up @@ -101,7 +101,7 @@ reconnect_node(Node, Peer) when is_atom(Node), is_pid(Peer) ->
disconnect_node(RPCNode, DisconnectNode) ->
rpc(RPCNode, erlang, disconnect_node, [DisconnectNode]).

disconnect_node_by_name(Config, Id) ->
disconnect_node_by_id(Config, Id) ->
Peer = maps:get(Id, proplists:get_value(peers, Config)),
Node = maps:get(Id, proplists:get_value(nodes, Config)),
%% We could need to retry to disconnect, if the local node is currently trying to establish a connection
Expand Down
6 changes: 3 additions & 3 deletions test/cets_test_setup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

-import(cets_test_peer, [
disconnect_node/2,
disconnect_node_by_name/2
disconnect_node_by_id/2
]).

-import(cets_test_rpc, [rpc/4]).
Expand Down Expand Up @@ -214,7 +214,7 @@ setup_two_nodes_and_discovery(Config, Flags) ->
Node1 = node(),
#{ct2 := Peer2} = proplists:get_value(peers, Config),
#{ct2 := Node2} = proplists:get_value(nodes, Config),
disconnect_node_by_name(Config, ct2),
disconnect_node_by_id(Config, ct2),
Tab = make_name(Config),
{ok, _Pid1} = start(Node1, Tab),
{ok, _Pid2} = start(Peer2, Tab),
Expand Down Expand Up @@ -252,7 +252,7 @@ setup_two_nodes_and_discovery(Config, Flags) ->
case lists:member(netsplit, Flags) of
true ->
%% Simulate a loss of connection between nodes
disconnect_node_by_name(Config, ct2);
disconnect_node_by_id(Config, ct2);
false ->
ok
end,
Expand Down

0 comments on commit 06d99a8

Please sign in to comment.