Remove rabbit_misc:atom_to_binary/1

Nowadays, we have erlang:atom_to_binary/1.
This commit is contained in:
David Ansari 2022-09-09 10:18:26 +00:00
parent 19628af139
commit b6952540a3
5 changed files with 17 additions and 20 deletions

View File

@ -194,14 +194,14 @@ change_policy(Config) ->
%% 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)]}),
{<<"nodes">>, [atom_to_binary(A),
atom_to_binary(B)]}),
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)]}),
{<<"nodes">>, [atom_to_binary(A),
atom_to_binary(C)]}),
assert_followers(A, ?QNAME, {A, [C]}, [{A, [B, C]}]),
%% Clear the policy, and we go back to non-mirrored
@ -210,8 +210,8 @@ change_policy(Config) ->
%% 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)]}),
{<<"nodes">>, [atom_to_binary(B),
atom_to_binary(C)]}),
assert_followers(A, ?QNAME, {B, [C]}, [{A, []}, {A, [B]}, {A, [C]}, {A, [B, C]}]),
ok.
@ -727,7 +727,7 @@ rebalance_nodes(Config) ->
amqp_channel:call(ACh, #'queue.declare'{queue = Q5}),
rabbit_ct_broker_helpers:set_ha_policy(
Config, A, <<"q.*">>,
{<<"nodes">>, [rabbit_misc:atom_to_binary(A), rabbit_misc:atom_to_binary(B)]}),
{<<"nodes">>, [atom_to_binary(A), atom_to_binary(B)]}),
timer:sleep(1000),
rabbit_ct_client_helpers:publish(ACh, Q1, 5),
@ -1020,7 +1020,7 @@ apply_policy(Config, N, all) ->
Config, N, ?POLICY, <<"all">>,
[{<<"ha-sync-mode">>, <<"automatic">>}]);
apply_policy(Config, N, {nodes, Nodes}) ->
NNodes = [rabbit_misc:atom_to_binary(Node) || Node <- Nodes],
NNodes = [atom_to_binary(Node) || Node <- Nodes],
rabbit_ct_broker_helpers:set_ha_policy(
Config, N, ?POLICY, {<<"nodes">>, NNodes},
[{<<"ha-sync-mode">>, <<"automatic">>}]);

View File

@ -193,7 +193,7 @@ eager_sync_auto_on_policy_change(Config) ->
%% Sync automatically once the policy is changed to tell us to.
rabbit_ct_client_helpers:publish(Ch, ?QNAME, ?MESSAGE_COUNT),
restart(Config, A),
Params = [rabbit_misc:atom_to_binary(N) || N <- [A, B]],
Params = [atom_to_binary(N) || N <- [A, B]],
rabbit_ct_broker_helpers:set_ha_policy(Config,
A, <<"^ha.two.">>, {<<"nodes">>, Params},
[{<<"ha-sync-mode">>, <<"automatic">>}]),

View File

@ -289,7 +289,7 @@ sigkill(Config, Node) ->
policy(Config, Node)->
Nodes = [
rabbit_misc:atom_to_binary(N)
atom_to_binary(N)
|| N <- rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
N =/= Node],
rabbit_ct_broker_helpers:set_ha_policy(Config, Node, <<".*">>,

View File

@ -43,7 +43,7 @@
-export([format/2, format_many/1, format_stderr/2]).
-export([unfold/2, ceil/1, queue_fold/3]).
-export([sort_field_table/1]).
-export([atom_to_binary/1, parse_bool/1, parse_int/1]).
-export([parse_bool/1, parse_int/1]).
-export([pid_to_string/1, string_to_pid/1,
pid_change_node/2, node_to_fake_pid/1]).
-export([hexify/1]).
@ -768,9 +768,6 @@ sort_field_table(Arguments) when is_map(Arguments) ->
sort_field_table(Arguments) ->
lists:keysort(1, Arguments).
atom_to_binary(A) ->
list_to_binary(atom_to_list(A)).
%% This provides a string representation of a pid that is the same
%% regardless of what node we are running on. The representation also
%% permits easy identification of the pid's node.

View File

@ -1807,9 +1807,9 @@ set_ha_policy_all(Config, Extra) ->
Config.
set_ha_policy_two_pos(Config) ->
Members = [
rabbit_misc:atom_to_binary(N)
|| N <- get_node_configs(Config, nodename)],
Members =
[atom_to_binary(N)
|| N <- get_node_configs(Config, nodename)],
TwoNodes = [M || M <- lists:sublist(Members, 2)],
set_ha_policy(Config, 0, <<"^ha.two.">>, {<<"nodes">>, TwoNodes},
[{<<"ha-promote-on-shutdown">>, <<"always">>}]),
@ -1819,9 +1819,9 @@ set_ha_policy_two_pos(Config) ->
Config.
set_ha_policy_two_pos_batch_sync(Config) ->
Members = [
rabbit_misc:atom_to_binary(N)
|| N <- get_node_configs(Config, nodename)],
Members =
[atom_to_binary(N)
|| N <- get_node_configs(Config, nodename)],
TwoNodes = [M || M <- lists:sublist(Members, 2)],
set_ha_policy(Config, 0, <<"^ha.two.">>, {<<"nodes">>, TwoNodes},
[{<<"ha-promote-on-shutdown">>, <<"always">>}]),