Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

Commit c84f130

Browse files
committed
rabbit_ct_broker_helpers: New helpers to change parameters and active plugins
1 parent 25db052 commit c84f130

File tree

1 file changed

+39
-19
lines changed

1 file changed

+39
-19
lines changed

src/rabbit_ct_broker_helpers.erl

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,19 @@
5353
get_connection_pids/1,
5454
get_queue_sup_pid/1,
5555

56-
set_parameter/5,
57-
clear_parameter/4,
58-
5956
set_policy/6,
6057
clear_policy/3,
6158
set_ha_policy/4, set_ha_policy/5,
6259
set_ha_policy_all/1,
6360
set_ha_policy_two_pos/1,
6461
set_ha_policy_two_pos_batch_sync/1,
6562

63+
set_parameter/5,
64+
clear_parameter/4,
65+
66+
enable_plugin/3,
67+
disable_plugin/3,
68+
6669
test_channel/0
6770
]).
6871

@@ -786,22 +789,6 @@ get_queue_sup_pid([{_, SupPid, _, _} | Rest], QueuePid) ->
786789
get_queue_sup_pid([], _QueuePid) ->
787790
undefined.
788791

789-
790-
%% -------------------------------------------------------------------
791-
%% Runtime parameter helpers.
792-
%% -------------------------------------------------------------------
793-
794-
set_parameter(Config, Node, Component, Key, Value) ->
795-
ok = rpc(Config, Node,
796-
rabbit_runtime_parameters, parse_set,
797-
[<<"/">>, Component, Key, Value, none]).
798-
799-
clear_parameter(Config, Node, Component, Key) ->
800-
ok = rpc(Config, Node,
801-
rabbit_runtime_parameters, clear,
802-
[<<"/">>, Component, Key]).
803-
804-
805792
%% -------------------------------------------------------------------
806793
%% Policy helpers.
807794
%% -------------------------------------------------------------------
@@ -854,6 +841,39 @@ set_ha_policy_two_pos_batch_sync(Config) ->
854841
{<<"ha-promote-on-shutdown">>, <<"always">>}]),
855842
Config.
856843

844+
%% -------------------------------------------------------------------
845+
%% Parameter helpers.
846+
%% -------------------------------------------------------------------
847+
848+
set_parameter(Config, Node, Component, Name, Value) ->
849+
ok = rpc(Config, Node,
850+
rabbit_runtime_parameters, set, [<<"/">>, Component, Name, Value, none]).
851+
852+
clear_parameter(Config, Node, Component, Name) ->
853+
ok = rpc(Config, Node,
854+
rabbit_runtime_parameters, clear, [<<"/">>, Component, Name]).
855+
856+
%% -------------------------------------------------------------------
857+
%% Parameter helpers.
858+
%% -------------------------------------------------------------------
859+
860+
enable_plugin(Config, Node, Plugin) ->
861+
plugin_action(Config, Node, enable, [Plugin], []).
862+
863+
disable_plugin(Config, Node, Plugin) ->
864+
plugin_action(Config, Node, disable, [Plugin], []).
865+
866+
plugin_action(Config, Node, Command, Args, Opts) ->
867+
PluginsFile = rabbit_ct_broker_helpers:get_node_config(Config, Node,
868+
enabled_plugins_file),
869+
PluginsDir = rabbit_ct_broker_helpers:get_node_config(Config, Node,
870+
plugins_dir),
871+
Nodename = rabbit_ct_broker_helpers:get_node_config(Config, Node,
872+
nodename),
873+
rabbit_ct_broker_helpers:rpc(Config, Node,
874+
rabbit_plugins_main, action,
875+
[Command, Nodename, Args, Opts, PluginsFile, PluginsDir]).
876+
857877
%% -------------------------------------------------------------------
858878

859879
test_channel() ->

0 commit comments

Comments
 (0)