diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2020-06-26 16:08:18 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2020-06-26 16:08:18 +0300 |
| commit | 4ac0e5f235de7522e233a67687535f39fdb62808 (patch) | |
| tree | d69ac8e0f505f837857b63e7a961bfedcb5dffe2 /test | |
| parent | 0c87fdba5934022af0ded91647181cecda846746 (diff) | |
| download | rabbitmq-server-git-4ac0e5f235de7522e233a67687535f39fdb62808.tar.gz | |
Avoid using unfortunate terms in more places
We have switched all doc guides to use "follower", "mirror" or "secondary"
years ago but some comments and test suites were never updated,
even though their changes would not be breaking.
This transition is a medium-term WIP.
Diffstat (limited to 'test')
| -rw-r--r-- | test/clustering_management_SUITE.erl | 36 | ||||
| -rw-r--r-- | test/crashing_queues_SUITE.erl | 10 | ||||
| -rw-r--r-- | test/dynamic_ha_SUITE.erl | 108 | ||||
| -rw-r--r-- | test/priority_queue_SUITE.erl | 14 | ||||
| -rw-r--r-- | test/sync_detection_SUITE.erl | 48 |
5 files changed, 108 insertions, 108 deletions
diff --git a/test/clustering_management_SUITE.erl b/test/clustering_management_SUITE.erl index 1825f89c85..34ad0b8cfd 100644 --- a/test/clustering_management_SUITE.erl +++ b/test/clustering_management_SUITE.erl @@ -66,7 +66,7 @@ groups() -> ]}, {clustered_4_nodes, [], [ {cluster_size_4, [], [ - forget_promotes_offline_slave + forget_promotes_offline_follower ]} ]} ]. @@ -388,13 +388,13 @@ forget_offline_removes_things(Config) -> passive = true})), ok. -forget_promotes_offline_slave(Config) -> +forget_promotes_offline_follower(Config) -> [A, B, C, D] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), ACh = rabbit_ct_client_helpers:open_channel(Config, A), QName = <<"mirrored-queue">>, declare(ACh, QName), set_ha_policy(Config, QName, A, [B, C]), - set_ha_policy(Config, QName, A, [C, D]), %% Test add and remove from recoverable_slaves + set_ha_policy(Config, QName, A, [C, D]), %% Test add and remove from recoverable_mirrors %% Publish and confirm amqp_channel:call(ACh, #'confirm.select'{}), @@ -436,41 +436,41 @@ set_ha_policy(Config, QName, Master, Slaves) -> Nodes = [list_to_binary(atom_to_list(N)) || N <- [Master | Slaves]], HaPolicy = {<<"nodes">>, Nodes}, rabbit_ct_broker_helpers:set_ha_policy(Config, Master, QName, HaPolicy), - await_slaves(QName, Master, Slaves). + await_followers(QName, Master, Slaves). -await_slaves(QName, Master, Slaves) -> - await_slaves_0(QName, Master, Slaves, 10). +await_followers(QName, Master, Slaves) -> + await_followers_0(QName, Master, Slaves, 10). -await_slaves_0(QName, Master, Slaves0, Tries) -> - {ok, Queue} = await_slaves_lookup_queue(QName, Master), +await_followers_0(QName, Master, Slaves0, Tries) -> + {ok, Queue} = await_followers_lookup_queue(QName, Master), SPids = amqqueue:get_slave_pids(Queue), ActMaster = amqqueue:qnode(Queue), ActSlaves = lists:usort([node(P) || P <- SPids]), Slaves1 = lists:usort(Slaves0), - await_slaves_1(QName, ActMaster, ActSlaves, Master, Slaves1, Tries). + await_followers_1(QName, ActMaster, ActSlaves, Master, Slaves1, Tries). -await_slaves_1(QName, _ActMaster, _ActSlaves, _Master, _Slaves, 0) -> - error({timeout_waiting_for_slaves, QName}); -await_slaves_1(QName, ActMaster, ActSlaves, Master, Slaves, Tries) -> +await_followers_1(QName, _ActMaster, _ActSlaves, _Master, _Slaves, 0) -> + error({timeout_waiting_for_followers, QName}); +await_followers_1(QName, ActMaster, ActSlaves, Master, Slaves, Tries) -> case {Master, Slaves} of {ActMaster, ActSlaves} -> ok; _ -> timer:sleep(250), - await_slaves_0(QName, Master, Slaves, Tries - 1) + await_followers_0(QName, Master, Slaves, Tries - 1) end. -await_slaves_lookup_queue(QName, Master) -> - await_slaves_lookup_queue(QName, Master, 10). +await_followers_lookup_queue(QName, Master) -> + await_followers_lookup_queue(QName, Master, 10). -await_slaves_lookup_queue(QName, _Master, 0) -> +await_followers_lookup_queue(QName, _Master, 0) -> error({timeout_looking_up_queue, QName}); -await_slaves_lookup_queue(QName, Master, Tries) -> +await_followers_lookup_queue(QName, Master, Tries) -> RpcArgs = [rabbit_misc:r(<<"/">>, queue, QName)], case rpc:call(Master, rabbit_amqqueue, lookup, RpcArgs) of {error, not_found} -> timer:sleep(250), - await_slaves_lookup_queue(QName, Master, Tries - 1); + await_followers_lookup_queue(QName, Master, Tries - 1); {ok, Q} -> {ok, Q} end. diff --git a/test/crashing_queues_SUITE.erl b/test/crashing_queues_SUITE.erl index ea453135e6..577ebb8517 100644 --- a/test/crashing_queues_SUITE.erl +++ b/test/crashing_queues_SUITE.erl @@ -99,7 +99,7 @@ crashing_mirrored(Config) -> #'queue.declare'{queue = QName, durable = true}), ok. -test_queue_failure(Node, Ch, RaceConn, MsgCount, SlaveCount, Decl) -> +test_queue_failure(Node, Ch, RaceConn, MsgCount, FollowerCount, Decl) -> #'queue.declare_ok'{queue = QName} = amqp_channel:call(Ch, Decl), try publish(Ch, QName, transient), @@ -107,7 +107,7 @@ test_queue_failure(Node, Ch, RaceConn, MsgCount, SlaveCount, Decl) -> Racer = spawn_declare_racer(RaceConn, Decl), kill_queue(Node, QName), assert_message_count(MsgCount, Ch, QName), - assert_slave_count(SlaveCount, Node, QName), + assert_follower_count(FollowerCount, Node, QName), stop_declare_racer(Racer) after amqp_channel:call(Ch, #'queue.delete'{queue = QName}) @@ -258,7 +258,7 @@ assert_message_count(Count, Ch, QName) -> amqp_channel:call(Ch, #'queue.declare'{queue = QName, passive = true}). -assert_slave_count(Count, Node, QName) -> +assert_follower_count(Count, Node, QName) -> Q = lookup(Node, QName), [{_, Pids}] = rpc:call(Node, rabbit_amqqueue, info, [Q, [slave_pids]]), RealCount = case Pids of @@ -270,7 +270,7 @@ assert_slave_count(Count, Node, QName) -> ok; _ when RealCount < Count -> timer:sleep(10), - assert_slave_count(Count, Node, QName); + assert_follower_count(Count, Node, QName); _ -> - exit({too_many_slaves, Count, RealCount}) + exit({too_many_replicas, Count, RealCount}) end. diff --git a/test/dynamic_ha_SUITE.erl b/test/dynamic_ha_SUITE.erl index f594683782..3b7eca40e4 100644 --- a/test/dynamic_ha_SUITE.erl +++ b/test/dynamic_ha_SUITE.erl @@ -60,10 +60,10 @@ groups() -> force_delete_if_no_master, promote_on_shutdown, promote_on_failure, - slave_recovers_after_vhost_failure, - slave_recovers_after_vhost_down_and_up, + follower_recovers_after_vhost_failure, + follower_recovers_after_vhost_down_and_up, master_migrates_on_vhost_down, - slave_recovers_after_vhost_down_and_master_migrated, + follower_recovers_after_vhost_down_and_master_migrated, queue_survive_adding_dead_vhost_mirror, dynamic_mirroring ]}, @@ -71,7 +71,7 @@ groups() -> change_policy, rapid_change, nodes_policy_should_pick_master_from_its_params, - promote_slave_after_standalone_restart, + promote_follower_after_standalone_restart, queue_survive_adding_dead_vhost_mirror, rebalance_all, rebalance_exactly, @@ -194,33 +194,33 @@ change_policy(Config) -> %% When we first declare a queue with no policy, it's not HA. amqp_channel:call(ACh, #'queue.declare'{queue = ?QNAME}), timer:sleep(200), - assert_slaves(A, ?QNAME, {A, ''}), + assert_followers(A, ?QNAME, {A, ''}), %% Give it policy "all", it becomes HA and gets all mirrors rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, <<"all">>), - assert_slaves(A, ?QNAME, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, ?QNAME, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), %% Give it policy "nodes", it gets specific mirrors rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, {<<"nodes">>, [rabbit_misc:atom_to_binary(A), rabbit_misc:atom_to_binary(B)]}), - assert_slaves(A, ?QNAME, {A, [B]}, [{A, [B, C]}]), + assert_followers(A, ?QNAME, {A, [B]}, [{A, [B, C]}]), %% Now explicitly change the mirrors rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, {<<"nodes">>, [rabbit_misc:atom_to_binary(A), rabbit_misc:atom_to_binary(C)]}), - assert_slaves(A, ?QNAME, {A, [C]}, [{A, [B, C]}]), + assert_followers(A, ?QNAME, {A, [C]}, [{A, [B, C]}]), %% Clear the policy, and we go back to non-mirrored ok = rabbit_ct_broker_helpers:clear_policy(Config, A, ?POLICY), - assert_slaves(A, ?QNAME, {A, ''}), + assert_followers(A, ?QNAME, {A, ''}), %% Test switching "away" from an unmirrored node rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, {<<"nodes">>, [rabbit_misc:atom_to_binary(B), rabbit_misc:atom_to_binary(C)]}), - assert_slaves(A, ?QNAME, {B, [C]}, [{A, []}, {A, [B]}, {A, [C]}, {A, [B, C]}]), + assert_followers(A, ?QNAME, {B, [C]}, [{A, []}, {A, [B]}, {A, [C]}, {A, [B, C]}]), ok. @@ -230,19 +230,19 @@ change_cluster(Config) -> ACh = rabbit_ct_client_helpers:open_channel(Config, A), amqp_channel:call(ACh, #'queue.declare'{queue = ?QNAME}), - assert_slaves(A, ?QNAME, {A, ''}), + assert_followers(A, ?QNAME, {A, ''}), %% Give it policy exactly 4, it should mirror to all 3 nodes rabbit_ct_broker_helpers:set_ha_policy(Config, A, ?POLICY, {<<"exactly">>, 4}), - assert_slaves(A, ?QNAME, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, ?QNAME, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), %% Add D and E, D or E joins in rabbit_ct_broker_helpers:cluster_nodes(Config, [A, D, E]), - assert_slaves(A, ?QNAME, [{A, [B, C, D]}, {A, [B, C, E]}], [{A, [B, C]}]), + assert_followers(A, ?QNAME, [{A, [B, C, D]}, {A, [B, C, E]}], [{A, [B, C]}]), %% Remove one, the other joins in rabbit_ct_broker_helpers:stop_node(Config, D), - assert_slaves(A, ?QNAME, [{A, [B, C, D]}, {A, [B, C, E]}], [{A, [B, C]}]), + assert_followers(A, ?QNAME, [{A, [B, C, D]}, {A, [B, C, E]}], [{A, [B, C]}]), ok. @@ -437,9 +437,9 @@ nodes_policy_should_pick_master_from_its_params(Config) -> %% --> Master: A %% Slaves: [B, C] or [C, B] Info = find_queue(?QNAME, A), - SSPids = proplists:get_value(synchronised_slave_pids, Info), + SSPids = proplists:get_value(synchronised_follower_pids, Info), - %% Choose mirror that isn't the first sync slave. Cover a bug that always + %% Choose mirror that isn't the first sync mirror. Cover a bug that always %% chose the first, even if it was not part of the policy LastSlave = node(lists:last(SSPids)), ?assertEqual(true, apply_policy_to_declared_queue(Config, Ch, [A], @@ -469,29 +469,29 @@ nodes_policy_should_pick_master_from_its_params(Config) -> amqp_channel:call(Ch, #'queue.delete'{queue = ?QNAME}), _ = rabbit_ct_broker_helpers:clear_policy(Config, A, ?POLICY). -slave_recovers_after_vhost_failure(Config) -> +follower_recovers_after_vhost_failure(Config) -> [A, B] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), rabbit_ct_broker_helpers:set_ha_policy_all(Config), ACh = rabbit_ct_client_helpers:open_channel(Config, A), - QName = <<"slave_recovers_after_vhost_failure-q">>, + QName = <<"follower_recovers_after_vhost_failure-q">>, amqp_channel:call(ACh, #'queue.declare'{queue = QName}), timer:sleep(500), - assert_slaves(A, QName, {A, [B]}, [{A, []}]), + assert_followers(A, QName, {A, [B]}, [{A, []}]), %% Crash vhost on a node hosting a mirror {ok, Sup} = rabbit_ct_broker_helpers:rpc(Config, B, rabbit_vhost_sup_sup, get_vhost_sup, [<<"/">>]), exit(Sup, foo), - assert_slaves(A, QName, {A, [B]}, [{A, []}]). + assert_followers(A, QName, {A, [B]}, [{A, []}]). -slave_recovers_after_vhost_down_and_up(Config) -> +follower_recovers_after_vhost_down_and_up(Config) -> [A, B] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), rabbit_ct_broker_helpers:set_ha_policy_all(Config), ACh = rabbit_ct_client_helpers:open_channel(Config, A), - QName = <<"slave_recovers_after_vhost_down_and_up-q">>, + QName = <<"follower_recovers_after_vhost_down_and_up-q">>, amqp_channel:call(ACh, #'queue.declare'{queue = QName}), timer:sleep(200), - assert_slaves(A, QName, {A, [B]}, [{A, []}]), + assert_followers(A, QName, {A, [B]}, [{A, []}]), %% Crash vhost on a node hosting a mirror rabbit_ct_broker_helpers:force_vhost_failure(Config, B, <<"/">>), @@ -504,7 +504,7 @@ slave_recovers_after_vhost_down_and_up(Config) -> {error,{already_started, _Sup}} -> ok end, - assert_slaves(A, QName, {A, [B]}, [{A, []}]). + assert_followers(A, QName, {A, [B]}, [{A, []}]). master_migrates_on_vhost_down(Config) -> [A, B] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), @@ -513,25 +513,25 @@ master_migrates_on_vhost_down(Config) -> QName = <<"master_migrates_on_vhost_down-q">>, amqp_channel:call(ACh, #'queue.declare'{queue = QName}), timer:sleep(500), - assert_slaves(A, QName, {A, [B]}, [{A, []}]), + assert_followers(A, QName, {A, [B]}, [{A, []}]), %% Crash vhost on the node hosting queue master rabbit_ct_broker_helpers:force_vhost_failure(Config, A, <<"/">>), timer:sleep(500), - assert_slaves(A, QName, {B, []}). + assert_followers(A, QName, {B, []}). -slave_recovers_after_vhost_down_and_master_migrated(Config) -> +follower_recovers_after_vhost_down_and_master_migrated(Config) -> [A, B] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), rabbit_ct_broker_helpers:set_ha_policy_all(Config), ACh = rabbit_ct_client_helpers:open_channel(Config, A), - QName = <<"slave_recovers_after_vhost_down_and_master_migrated-q">>, + QName = <<"follower_recovers_after_vhost_down_and_master_migrated-q">>, amqp_channel:call(ACh, #'queue.declare'{queue = QName}), timer:sleep(500), - assert_slaves(A, QName, {A, [B]}, [{A, []}]), + assert_followers(A, QName, {A, [B]}, [{A, []}]), %% Crash vhost on the node hosting queue master rabbit_ct_broker_helpers:force_vhost_failure(Config, A, <<"/">>), timer:sleep(500), - assert_slaves(B, QName, {B, []}), + assert_followers(B, QName, {B, []}), %% Restart the vhost on the node (previously) hosting queue master case rabbit_ct_broker_helpers:rpc(Config, A, rabbit_vhost_sup_sup, start_vhost, [<<"/">>]) of @@ -539,7 +539,7 @@ slave_recovers_after_vhost_down_and_master_migrated(Config) -> {error,{already_started, _Sup}} -> ok end, timer:sleep(500), - assert_slaves(B, QName, {B, [A]}, [{B, []}]). + assert_followers(B, QName, {B, [A]}, [{B, []}]). random_policy(Config) -> run_proper(fun prop_random_policy/1, [Config]). @@ -558,7 +558,7 @@ failing_random_policies(Config) -> [all, undefined, {exactly, 2}, all, {exactly, 3}, {exactly, 3}, undefined, {exactly, 3}, all])). -promote_slave_after_standalone_restart(Config) -> +promote_follower_after_standalone_restart(Config) -> %% Tests that mirrors 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 @@ -620,11 +620,11 @@ rebalance_all(Config) -> rabbit_ct_client_helpers:publish(ACh, Q1, 5), rabbit_ct_client_helpers:publish(ACh, Q2, 3), - assert_slaves(A, Q1, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), - assert_slaves(A, Q2, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), - assert_slaves(A, Q3, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), - assert_slaves(A, Q4, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), - assert_slaves(A, Q5, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q1, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q2, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q3, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q4, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q5, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), {ok, Summary} = rpc:call(A, rabbit_amqqueue, rebalance, [classic, ".*", ".*"]), @@ -639,8 +639,8 @@ rebalance_all(Config) -> rabbit_ct_helpers:await_condition(Condition1, 60000), %% Check that Q1 and Q2 haven't moved - assert_slaves(A, Q1, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), - assert_slaves(A, Q2, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q1, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), + assert_followers(A, Q2, {A, [B, C]}, [{A, []}, {A, [B]}, {A, [C]}]), ok. @@ -795,31 +795,31 @@ rebalance_multiple_blocked1(_) -> %%---------------------------------------------------------------------------- -assert_slaves(RPCNode, QName, Exp) -> - assert_slaves(RPCNode, QName, Exp, []). +assert_followers(RPCNode, QName, Exp) -> + assert_followers(RPCNode, QName, Exp, []). -assert_slaves(RPCNode, QName, Exp, PermittedIntermediate) -> - assert_slaves0(RPCNode, QName, Exp, +assert_followers(RPCNode, QName, Exp, PermittedIntermediate) -> + assert_followers0(RPCNode, QName, Exp, [{get(previous_exp_m_node), get(previous_exp_s_nodes)} | PermittedIntermediate], 1000). -assert_slaves0(_RPCNode, _QName, [], _PermittedIntermediate, _Attempts) -> +assert_followers0(_RPCNode, _QName, [], _PermittedIntermediate, _Attempts) -> error(invalid_expectation); -assert_slaves0(RPCNode, QName, [{ExpMNode, ExpSNodes}|T], PermittedIntermediate, Attempts) -> - case assert_slaves1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, nofail) of +assert_followers0(RPCNode, QName, [{ExpMNode, ExpSNodes}|T], PermittedIntermediate, Attempts) -> + case assert_followers1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, nofail) of ok -> ok; failed -> - assert_slaves0(RPCNode, QName, T, PermittedIntermediate, Attempts - 1) + assert_followers0(RPCNode, QName, T, PermittedIntermediate, Attempts - 1) end; -assert_slaves0(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts) -> - assert_slaves1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, fail). +assert_followers0(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts) -> + assert_followers1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, fail). -assert_slaves1(_RPCNode, _QName, _Exp, _PermittedIntermediate, 0, fail) -> - error(give_up_waiting_for_slaves); -assert_slaves1(_RPCNode, _QName, _Exp, _PermittedIntermediate, 0, nofail) -> +assert_followers1(_RPCNode, _QName, _Exp, _PermittedIntermediate, 0, fail) -> + error(give_up_waiting_for_followers); +assert_followers1(_RPCNode, _QName, _Exp, _PermittedIntermediate, 0, nofail) -> failed; -assert_slaves1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, FastFail) -> +assert_followers1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts, FastFail) -> Q = find_queue(QName, RPCNode), Pid = proplists:get_value(pid, Q), SPids = proplists:get_value(slave_pids, Q), @@ -850,7 +850,7 @@ assert_slaves1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Att ct:pal("Waiting to leave state ~p~n Waiting for ~p~n", [State, {ExpMNode, ExpSNodes}]), timer:sleep(200), - assert_slaves1(RPCNode, QName, {ExpMNode, ExpSNodes}, + assert_followers1(RPCNode, QName, {ExpMNode, ExpSNodes}, PermittedIntermediate, Attempts - 1, FastFail) end; diff --git a/test/priority_queue_SUITE.erl b/test/priority_queue_SUITE.erl index 97381fd61c..2e29aa8725 100644 --- a/test/priority_queue_SUITE.erl +++ b/test/priority_queue_SUITE.erl @@ -56,7 +56,7 @@ groups() -> mirror_queue_auto_ack, mirror_fast_reset_policy, mirror_reset_policy, - mirror_stop_pending_slaves + mirror_stop_pending_followers ]} ]. @@ -449,7 +449,7 @@ mirror_queue_sync(Config) -> publish(Ch, Q, [1, 2, 3, 1, 2, 3]), %% master now has 9, mirror 6. get_partial(Ch, Q, manual_ack, [3, 3, 3, 2, 2, 2]), - %% So some but not all are unacked at the slave + %% So some but not all are unacked at the mirror Nodename0 = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename), rabbit_ct_broker_helpers:control_action(sync_queue, Nodename0, [binary_to_list(Q)], [{"-p", "/"}]), @@ -541,7 +541,7 @@ mirror_queue_sync_order(Config) -> {3, <<"msg5">>}]), rabbit_ct_client_helpers:close_channel(Ch), - %% Add and sync slave + %% Add and sync mirror ok = rabbit_ct_broker_helpers:set_ha_policy( Config, A, <<"^mirror_queue_sync_order-queue$">>, <<"all">>), rabbit_ct_broker_helpers:control_action(sync_queue, A, @@ -602,7 +602,7 @@ mirror_reset_policy(Config, Wait) -> rabbit_ct_client_helpers:close_connection(Conn), passed. -mirror_stop_pending_slaves(Config) -> +mirror_stop_pending_followers(Config) -> A = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename), B = rabbit_ct_broker_helpers:get_node_config(Config, 1, nodename), C = rabbit_ct_broker_helpers:get_node_config(Config, 2, nodename), @@ -611,17 +611,17 @@ mirror_stop_pending_slaves(Config) -> Config, Nodename, application, set_env, [rabbit, slave_wait_timeout, 0]) || Nodename <- [A, B, C]], {Conn, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, A), - Q = <<"mirror_stop_pending_slaves-queue">>, + Q = <<"mirror_stop_pending_followers-queue">>, declare(Ch, Q, 5), publish_many(Ch, Q, 20000), [begin rabbit_ct_broker_helpers:set_ha_policy( - Config, A, <<"^mirror_stop_pending_slaves-queue$">>, <<"all">>, + Config, A, <<"^mirror_stop_pending_followers-queue$">>, <<"all">>, [{<<"ha-sync-mode">>, <<"automatic">>}]), wait_for_sync(Config, A, rabbit_misc:r(<<"/">>, queue, Q), 2), rabbit_ct_broker_helpers:clear_policy( - Config, A, <<"^mirror_stop_pending_slaves-queue$">>) + Config, A, <<"^mirror_stop_pending_followers-queue$">>) end || _ <- lists:seq(1, 15)], delete(Ch, Q), diff --git a/test/sync_detection_SUITE.erl b/test/sync_detection_SUITE.erl index 6041218268..42e224d112 100644 --- a/test/sync_detection_SUITE.erl +++ b/test/sync_detection_SUITE.erl @@ -32,10 +32,10 @@ all() -> groups() -> [ {cluster_size_2, [], [ - slave_synchronization + follower_synchronization ]}, {cluster_size_3, [], [ - slave_synchronization_ttl + follower_synchronization_ttl ]} ]. @@ -85,7 +85,7 @@ end_per_testcase(Testcase, Config) -> %% Testcases. %% ------------------------------------------------------------------- -slave_synchronization(Config) -> +follower_synchronization(Config) -> [Master, Slave] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), Channel = rabbit_ct_client_helpers:open_channel(Config, Master), @@ -107,13 +107,13 @@ slave_synchronization(Config) -> rabbit_ct_broker_helpers:start_broker(Config, Slave), - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), send_dummy_message(Channel, Queue), % 1 - 1 - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), amqp_channel:cast(Channel, #'basic.ack'{delivery_tag = Tag1}), % 1 - 0 - slave_synced(Master, Queue), + follower_synced(Master, Queue), %% We restart the mirror and we send a message, so that the mirror will only %% have one of the messages. @@ -122,26 +122,26 @@ slave_synchronization(Config) -> send_dummy_message(Channel, Queue), % 2 - 0 - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), %% We reject the message that the mirror doesn't have, and verify that it's %% still unsynced {#'basic.get_ok'{delivery_tag = Tag2}, _} = amqp_channel:call(Channel, #'basic.get'{queue = Queue}), % 1 - 1 - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), amqp_channel:cast(Channel, #'basic.reject'{ delivery_tag = Tag2, requeue = true }), % 2 - 0 - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), {#'basic.get_ok'{delivery_tag = Tag3}, _} = amqp_channel:call(Channel, #'basic.get'{queue = Queue}), % 1 - 1 amqp_channel:cast(Channel, #'basic.ack'{delivery_tag = Tag3}), % 1 - 0 - slave_synced(Master, Queue), + follower_synced(Master, Queue), {#'basic.get_ok'{delivery_tag = Tag4}, _} = amqp_channel:call(Channel, #'basic.get'{queue = Queue}), % 0 - 1 amqp_channel:cast(Channel, #'basic.ack'{delivery_tag = Tag4}), % 0 - 0 - slave_synced(Master, Queue). + follower_synced(Master, Queue). -slave_synchronization_ttl(Config) -> +follower_synchronization_ttl(Config) -> [Master, Slave, DLX] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename), Channel = rabbit_ct_client_helpers:open_channel(Config, Master), @@ -165,33 +165,33 @@ slave_synchronization_ttl(Config) -> auto_delete = false, arguments = Args}), - slave_synced(Master, Queue), + follower_synced(Master, Queue), %% All unknown rabbit_ct_broker_helpers:stop_broker(Config, Slave), send_dummy_message(Channel, Queue), send_dummy_message(Channel, Queue), rabbit_ct_broker_helpers:start_broker(Config, Slave), - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), wait_for_messages(DLXQueue, DLXChannel, 2), - slave_synced(Master, Queue), + follower_synced(Master, Queue), %% 1 unknown, 1 known rabbit_ct_broker_helpers:stop_broker(Config, Slave), send_dummy_message(Channel, Queue), rabbit_ct_broker_helpers:start_broker(Config, Slave), - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), send_dummy_message(Channel, Queue), - slave_unsynced(Master, Queue), + follower_unsynced(Master, Queue), wait_for_messages(DLXQueue, DLXChannel, 2), - slave_synced(Master, Queue), + follower_synced(Master, Queue), %% %% both known send_dummy_message(Channel, Queue), send_dummy_message(Channel, Queue), - slave_synced(Master, Queue), + follower_synced(Master, Queue), wait_for_messages(DLXQueue, DLXChannel, 2), - slave_synced(Master, Queue), + follower_synced(Master, Queue), ok. @@ -200,7 +200,7 @@ send_dummy_message(Channel, Queue) -> Publish = #'basic.publish'{exchange = <<>>, routing_key = Queue}, amqp_channel:cast(Channel, Publish, #amqp_msg{payload = Payload}). -slave_pids(Node, Queue) -> +follower_pids(Node, Queue) -> {ok, Q} = rpc:call(Node, rabbit_amqqueue, lookup, [rabbit_misc:r(<<"/">>, queue, Queue)]), SSP = synchronised_slave_pids, @@ -223,17 +223,17 @@ wait_for_sync_status(N, Max, Status, Node, Queue) when N >= Max -> {expected_status, Status}, {max_tried, Max}]}); wait_for_sync_status(N, Max, Status, Node, Queue) -> - Synced = length(slave_pids(Node, Queue)) =:= 1, + Synced = length(follower_pids(Node, Queue)) =:= 1, case Synced =:= Status of true -> ok; false -> timer:sleep(?LOOP_RECURSION_DELAY), wait_for_sync_status(N + 1, Max, Status, Node, Queue) end. -slave_synced(Node, Queue) -> +follower_synced(Node, Queue) -> wait_for_sync_status(true, Node, Queue). -slave_unsynced(Node, Queue) -> +follower_unsynced(Node, Queue) -> wait_for_sync_status(false, Node, Queue). wait_for_messages(Queue, Channel, N) -> |
