Skip to content

Commit 4cdad4b

Browse files
Merge branch 'master' into rabbitmq-server-1146-full
2 parents d89a50a + 2ee4ef2 commit 4cdad4b

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

src/rabbit_plugins.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ strictly_plugins(Plugins, AllPlugins) ->
213213
end, Plugins).
214214

215215
strictly_plugins(Plugins) ->
216-
{ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir),
216+
ExpandDir = plugins_expand_dir(),
217217
AllPlugins = list(ExpandDir),
218218
lists:filter(
219219
fun(Name) ->
@@ -416,7 +416,7 @@ remove_version_preview_part(Version) ->
416416
iolist_to_binary(rabbit_semver:format({Ver, {[], []}})).
417417

418418
clean_plugins(Plugins) ->
419-
{ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir),
419+
ExpandDir = plugins_expand_dir(),
420420
[clean_plugin(Plugin, ExpandDir) || Plugin <- Plugins].
421421

422422
clean_plugin(Plugin, ExpandDir) ->

test/dynamic_ha_SUITE.erl

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ groups() ->
6262
{cluster_size_3, [], [
6363
change_policy,
6464
rapid_change,
65-
nodes_policy_should_pick_master_from_its_params
65+
nodes_policy_should_pick_master_from_its_params,
66+
promote_slave_after_standalone_restart
6667
% FIXME: Re-enable those tests when the know issues are
6768
% fixed.
6869
% failing_random_policies,
@@ -319,6 +320,45 @@ failing_random_policies(Config) ->
319320
[all, undefined, {exactly, 2}, all, {exactly, 3}, {exactly, 3},
320321
undefined, {exactly, 3}, all])).
321322

323+
promote_slave_after_standalone_restart(Config) ->
324+
%% Tests that slaves can be brought up standalone after forgetting the rest
325+
%% of the cluster. Slave ordering should be irrelevant.
326+
%% https://github.com/rabbitmq/rabbitmq-server/issues/1213
327+
[A, B, C] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
328+
Ch = rabbit_ct_client_helpers:open_channel(Config, A),
329+
330+
rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, <<"all">>),
331+
amqp_channel:call(Ch, #'queue.declare'{queue = ?QNAME,
332+
durable = true}),
333+
334+
rabbit_ct_client_helpers:publish(Ch, ?QNAME, 15),
335+
rabbit_ct_client_helpers:close_channel(Ch),
336+
337+
timer:sleep(500),
338+
15 = proplists:get_value(messages, find_queue(?QNAME, A)),
339+
340+
rabbit_ct_broker_helpers:stop_node(Config, C),
341+
rabbit_ct_broker_helpers:stop_node(Config, B),
342+
rabbit_ct_broker_helpers:stop_node(Config, A),
343+
344+
%% Restart one slave
345+
forget_cluster_node(Config, B, C),
346+
forget_cluster_node(Config, B, A),
347+
348+
ok = rabbit_ct_broker_helpers:start_node(Config, B),
349+
15 = proplists:get_value(messages, find_queue(?QNAME, B)),
350+
ok = rabbit_ct_broker_helpers:stop_node(Config, B),
351+
352+
%% Restart the other
353+
forget_cluster_node(Config, C, B),
354+
forget_cluster_node(Config, C, A),
355+
356+
ok = rabbit_ct_broker_helpers:start_node(Config, C),
357+
15 = proplists:get_value(messages, find_queue(?QNAME, C)),
358+
ok = rabbit_ct_broker_helpers:stop_node(Config, C),
359+
360+
ok.
361+
322362
%%----------------------------------------------------------------------------
323363

324364
assert_slaves(RPCNode, QName, Exp) ->
@@ -528,3 +568,7 @@ apply_policy(Config, N, {exactly, Exactly}) ->
528568
rabbit_ct_broker_helpers:set_ha_policy(
529569
Config, N, ?POLICY, {<<"exactly">>, Exactly},
530570
[{<<"ha-sync-mode">>, <<"automatic">>}]).
571+
572+
forget_cluster_node(Config, Node, NodeToRemove) ->
573+
rabbit_ct_broker_helpers:rabbitmqctl(
574+
Config, Node, ["forget_cluster_node", "--offline", NodeToRemove]).

0 commit comments

Comments
 (0)