feat(cth-cluster): make `restart/1` more generic
This commit is contained in:
parent
5fd5fc76e5
commit
ae89b61af0
|
@ -163,7 +163,7 @@ mk_clientid(Prefix, ID) ->
|
||||||
|
|
||||||
restart_node(Node, NodeSpec) ->
|
restart_node(Node, NodeSpec) ->
|
||||||
?tp(will_restart_node, #{}),
|
?tp(will_restart_node, #{}),
|
||||||
emqx_cth_cluster:restart(Node, NodeSpec),
|
emqx_cth_cluster:restart(NodeSpec),
|
||||||
wait_nodeup(Node),
|
wait_nodeup(Node),
|
||||||
?tp(restarted_node, #{}),
|
?tp(restarted_node, #{}),
|
||||||
ok.
|
ok.
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
%% in `end_per_suite/1` or `end_per_group/2`) with the result from step 2.
|
%% in `end_per_suite/1` or `end_per_group/2`) with the result from step 2.
|
||||||
-module(emqx_cth_cluster).
|
-module(emqx_cth_cluster).
|
||||||
|
|
||||||
-export([start/1, start/2, restart/1, restart/2]).
|
-export([start/1, start/2, restart/1]).
|
||||||
-export([stop/1, stop_node/1]).
|
-export([stop/1, stop_node/1]).
|
||||||
|
|
||||||
-export([start_bare_nodes/1, start_bare_nodes/2]).
|
-export([start_bare_nodes/1, start_bare_nodes/2]).
|
||||||
|
@ -163,13 +163,13 @@ wait_clustered([Node | Nodes] = All, Check, Deadline) ->
|
||||||
wait_clustered(All, Check, Deadline)
|
wait_clustered(All, Check, Deadline)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
restart(NodeSpec) ->
|
restart(NodeSpecs = [_ | _]) ->
|
||||||
restart(maps:get(name, NodeSpec), NodeSpec).
|
Nodes = [maps:get(name, Spec) || Spec <- NodeSpecs],
|
||||||
|
ct:pal("Stopping peer nodes: ~p", [Nodes]),
|
||||||
restart(Node, Spec) ->
|
ok = stop(Nodes),
|
||||||
ct:pal("Stopping peer node ~p", [Node]),
|
start([Spec#{boot_type => restart} || Spec <- NodeSpecs]);
|
||||||
ok = emqx_cth_peer:stop(Node),
|
restart(NodeSpec = #{}) ->
|
||||||
start([Spec#{boot_type => restart}]).
|
restart([NodeSpec]).
|
||||||
|
|
||||||
mk_nodespecs(Nodes, ClusterOpts) ->
|
mk_nodespecs(Nodes, ClusterOpts) ->
|
||||||
NodeSpecs = lists:zipwith(
|
NodeSpecs = lists:zipwith(
|
||||||
|
|
Loading…
Reference in New Issue