diff options
| author | Michael Klishin <michael@novemberain.com> | 2017-05-09 12:20:49 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-09 12:20:49 +0300 |
| commit | 789f0ba932f0d3ff3f9b23354a8df5d5f033b0e2 (patch) | |
| tree | 4d4d33bec4738c405543d08c196087bd2dca6116 | |
| parent | d3542a400c7f50ad25179aee600b30a80ac2695d (diff) | |
| parent | 407a349a2007812c76f8f7b588b4b42b1f1a8415 (diff) | |
| download | rabbitmq-server-git-789f0ba932f0d3ff3f9b23354a8df5d5f033b0e2.tar.gz | |
Merge pull request #1215 from rabbitmq/rabbitmq-server-1213
Test single slave restart after forget_cluster_nodes in offline mode
| -rw-r--r-- | test/dynamic_ha_SUITE.erl | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/test/dynamic_ha_SUITE.erl b/test/dynamic_ha_SUITE.erl index a55641c90c..a07ed5f984 100644 --- a/test/dynamic_ha_SUITE.erl +++ b/test/dynamic_ha_SUITE.erl @@ -62,7 +62,8 @@ groups() -> {cluster_size_3, [], [ change_policy, rapid_change, - nodes_policy_should_pick_master_from_its_params + nodes_policy_should_pick_master_from_its_params, + promote_slave_after_standalone_restart % FIXME: Re-enable those tests when the know issues are % fixed. % failing_random_policies, @@ -319,6 +320,45 @@ failing_random_policies(Config) -> [all, undefined, {exactly, 2}, all, {exactly, 3}, {exactly, 3}, undefined, {exactly, 3}, all])). +promote_slave_after_standalone_restart(Config) -> + %% Tests that slaves can be brought up standalone after forgetting the rest + %% of the cluster. Slave ordering should be irrelevant. + %% https://github.com/rabbitmq/rabbitmq-server/issues/1213 + [A, B, C] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), + Ch = rabbit_ct_client_helpers:open_channel(Config, A), + + rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, <<"all">>), + amqp_channel:call(Ch, #'queue.declare'{queue = ?QNAME, + durable = true}), + + rabbit_ct_client_helpers:publish(Ch, ?QNAME, 15), + rabbit_ct_client_helpers:close_channel(Ch), + + timer:sleep(500), + 15 = proplists:get_value(messages, find_queue(?QNAME, A)), + + rabbit_ct_broker_helpers:stop_node(Config, C), + rabbit_ct_broker_helpers:stop_node(Config, B), + rabbit_ct_broker_helpers:stop_node(Config, A), + + %% Restart one slave + forget_cluster_node(Config, B, C), + forget_cluster_node(Config, B, A), + + ok = rabbit_ct_broker_helpers:start_node(Config, B), + 15 = proplists:get_value(messages, find_queue(?QNAME, B)), + ok = rabbit_ct_broker_helpers:stop_node(Config, B), + + %% Restart the other + forget_cluster_node(Config, C, B), + forget_cluster_node(Config, C, A), + + ok = rabbit_ct_broker_helpers:start_node(Config, C), + 15 = proplists:get_value(messages, find_queue(?QNAME, C)), + ok = rabbit_ct_broker_helpers:stop_node(Config, C), + + ok. + %%---------------------------------------------------------------------------- assert_slaves(RPCNode, QName, Exp) -> @@ -528,3 +568,7 @@ apply_policy(Config, N, {exactly, Exactly}) -> rabbit_ct_broker_helpers:set_ha_policy( Config, N, ?POLICY, {<<"exactly">>, Exactly}, [{<<"ha-sync-mode">>, <<"automatic">>}]). + +forget_cluster_node(Config, Node, NodeToRemove) -> + rabbit_ct_broker_helpers:rabbitmqctl( + Config, Node, ["forget_cluster_node", "--offline", NodeToRemove]). |
