Skip to content

Commit b33aa2a

Browse files
Skip test if plugin is not installed
1 parent a591ff5 commit b33aa2a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

deps/rabbitmq_local_exchange/src/rabbit_exchange_type_local.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
-rabbit_boot_step({?MODULE, [
1313
{description, "exchange type local"},
1414
{mfa, {rabbit_registry, register, [exchange, <<"x-local">>, ?MODULE]}},
15+
{cleanup, {?MODULE, disable_plugin, []}},
1516
{requires, rabbit_registry},
1617
{enables, kernel_ready}
1718
]}).
@@ -30,7 +31,8 @@
3031
serialise_events/0,
3132
validate/1,
3233
info/1,
33-
info/2
34+
info/2,
35+
disable_plugin/0
3436
]).
3537

3638
description() ->
@@ -76,3 +78,7 @@ remove_bindings(_Serial, _X, _Bs) -> ok.
7678
validate_binding(_X, _B) -> ok.
7779
assert_args_equivalence(X, Args) ->
7880
rabbit_exchange:assert_args_equivalence(X, Args).
81+
82+
disable_plugin() ->
83+
rabbit_registry:unregister(exchange, <<"x-local">>),
84+
ok.

deps/rabbitmq_local_exchange/test/rabbit_local_exchange_SUITE.erl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ init_per_testcase(Testcase, Config) ->
5454
TestCaseName = rabbit_ct_helpers:config_to_testcase_name(Config, Testcase),
5555
Config1 = rabbit_ct_helpers:set_config(Config, {test_resource_name,
5656
re:replace(TestCaseName, "/", "-", [global, {return, list}])}),
57+
Nodes = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
58+
[case rabbit_ct_broker_helpers:enable_plugin(Config, N, rabbitmq_local_exchange) of
59+
ok -> ok;
60+
_ -> {skip}
61+
end || N <- Nodes],
5762
rabbit_ct_helpers:testcase_started(Config1, Testcase).
5863

5964
end_per_testcase(Testcase, Config) ->
@@ -64,6 +69,8 @@ end_per_testcase(Testcase, Config) ->
6469
%% -------------------------------------------------------------------
6570

6671
routed_to_one_local_queue_test(Config) ->
72+
% ok = ensure_plugin_enabled(Config),
73+
6774
E = make_exchange_name(Config, "0"),
6875
declare_exchange(Config, E),
6976
%% declare queue on the first two nodes: 0, 1
@@ -76,6 +83,8 @@ routed_to_one_local_queue_test(Config) ->
7683
passed.
7784

7885
routed_to_one_nonlocal_queue_test(Config) ->
86+
% ok = ensure_plugin_enabled(Config),
87+
7988
E = make_exchange_name(Config, "0"),
8089
declare_exchange(Config, E),
8190
%% declare queue on nodes 0, 1

0 commit comments

Comments
 (0)