Replace ct:pal with ct:log in select places

This commit is contained in:
Iliia Khaprov 2025-05-26 14:36:43 +02:00
parent 8512a4459b
commit 6b528e2caf
No known key found for this signature in database
GPG Key ID: 4DCFF8F358E49AED
5 changed files with 23 additions and 23 deletions

View File

@ -61,7 +61,7 @@ web_amqp(Config) ->
flush(Prefix) -> flush(Prefix) ->
receive receive
Msg -> Msg ->
ct:pal("~p flushed: ~p~n", [Prefix, Msg]), ct:log("~p flushed: ~p~n", [Prefix, Msg]),
flush(Prefix) flush(Prefix)
after 1 -> after 1 ->
ok ok

View File

@ -82,10 +82,10 @@ long_names_work(_Config) ->
ipv6_works(Config) -> ipv6_works(Config) ->
PrivDir = ?config(priv_dir, Config), PrivDir = ?config(priv_dir, Config),
InetrcFilename = filename:join(PrivDir, "inetrc-ipv6.erl"), InetrcFilename = filename:join(PrivDir, "inetrc-ipv6.erl"),
ct:pal("Inetrc filename:~n~0p", [InetrcFilename]), ct:log("Inetrc filename:~n~0p", [InetrcFilename]),
Inetrc = [{inet6, true}], Inetrc = [{inet6, true}],
InetrcContent = [io_lib:format("~p.~n", [Param]) || Param <- Inetrc], InetrcContent = [io_lib:format("~p.~n", [Param]) || Param <- Inetrc],
ct:pal("Inetrc file content:~n---8<---~n~s---8<---", [InetrcContent]), ct:log("Inetrc file content:~n---8<---~n~s---8<---", [InetrcContent]),
ok = file:write_file(InetrcFilename, InetrcContent), ok = file:write_file(InetrcFilename, InetrcContent),
InetrcArg = rabbit_misc:format("~0p", [InetrcFilename]), InetrcArg = rabbit_misc:format("~0p", [InetrcFilename]),
@ -106,10 +106,10 @@ inetrc_file_as_atom_works(_Config) ->
%% might not be defined). %% might not be defined).
TmpDir = os:getenv("TEMP", os:getenv("TMP", os:getenv("TMPDIR", "/tmp"))), TmpDir = os:getenv("TEMP", os:getenv("TMP", os:getenv("TMPDIR", "/tmp"))),
InetrcFilename = filename:join(TmpDir, "inetrc-ipv6.erl"), InetrcFilename = filename:join(TmpDir, "inetrc-ipv6.erl"),
ct:pal("Inetrc filename:~n~0p", [InetrcFilename]), ct:log("Inetrc filename:~n~0p", [InetrcFilename]),
Inetrc = [{inet6, true}], Inetrc = [{inet6, true}],
InetrcContent = [io_lib:format("~p.~n", [Param]) || Param <- Inetrc], InetrcContent = [io_lib:format("~p.~n", [Param]) || Param <- Inetrc],
ct:pal("Inetrc file content:~n---8<---~n~s---8<---", [InetrcContent]), ct:log("Inetrc file content:~n---8<---~n~s---8<---", [InetrcContent]),
ok = file:write_file(InetrcFilename, InetrcContent), ok = file:write_file(InetrcFilename, InetrcContent),
InetrcArg = rabbit_misc:format("~0p", [list_to_atom(InetrcFilename)]), InetrcArg = rabbit_misc:format("~0p", [list_to_atom(InetrcFilename)]),
@ -138,27 +138,27 @@ tls_dist_works(Config) ->
PrivDir = ?config(priv_dir, Config), PrivDir = ?config(priv_dir, Config),
SslOptFilename = filename:join(PrivDir, "ssl-options.erl"), SslOptFilename = filename:join(PrivDir, "ssl-options.erl"),
ct:pal("SSL options filename:~n~0p", [SslOptFilename]), ct:log("SSL options filename:~n~0p", [SslOptFilename]),
SslOptContent = rabbit_misc:format("~p.~n", [SslOptions]), SslOptContent = rabbit_misc:format("~p.~n", [SslOptions]),
ct:pal("SSL options file content:~n---8<---~n~s---8<---", [SslOptContent]), ct:log("SSL options file content:~n---8<---~n~s---8<---", [SslOptContent]),
ok = file:write_file(SslOptFilename, SslOptContent), ok = file:write_file(SslOptFilename, SslOptContent),
%% We need to read the certificate's Subject ID to see what hostname is %% We need to read the certificate's Subject ID to see what hostname is
%% used in the certificate and use the same to start the test Erlang nodes. %% used in the certificate and use the same to start the test Erlang nodes.
%% We also need to pay attention if the name is short or long. %% We also need to pay attention if the name is short or long.
{ok, ServerCertBin} = file:read_file(ServerCert), {ok, ServerCertBin} = file:read_file(ServerCert),
ct:pal("ServerCertBin = ~p", [ServerCertBin]), ct:log("ServerCertBin = ~p", [ServerCertBin]),
[DecodedCert] = public_key:pem_decode(ServerCertBin), [DecodedCert] = public_key:pem_decode(ServerCertBin),
ct:pal("DecodedCert = ~p", [DecodedCert]), ct:log("DecodedCert = ~p", [DecodedCert]),
DecodedCert1 = element(2, DecodedCert), DecodedCert1 = element(2, DecodedCert),
{_SerialNr, {rdnSequence, IssuerAttrs}} = public_key:pkix_subject_id( {_SerialNr, {rdnSequence, IssuerAttrs}} = public_key:pkix_subject_id(
DecodedCert1), DecodedCert1),
ct:pal("IssuerAttrs = ~p", [IssuerAttrs]), ct:log("IssuerAttrs = ~p", [IssuerAttrs]),
[ServerName] = [Value [ServerName] = [Value
|| [#'AttributeTypeAndValue'{type = {2, 5, 4, 3}, || [#'AttributeTypeAndValue'{type = {2, 5, 4, 3},
value = {utf8String, Value}}] value = {utf8String, Value}}]
<- IssuerAttrs], <- IssuerAttrs],
ct:pal("ServerName = ~p", [ServerName]), ct:log("ServerName = ~p", [ServerName]),
UseLongnames = re:run(ServerName, "\\.", [{capture, none}]) =:= match, UseLongnames = re:run(ServerName, "\\.", [{capture, none}]) =:= match,
PeerOptions = #{host => binary_to_list(ServerName), PeerOptions = #{host => binary_to_list(ServerName),
@ -188,7 +188,7 @@ do_test_query_node_props(Peers) ->
NodeAPid, NodeAPid,
rabbit_peer_discovery, query_node_props, [[NodeB]], rabbit_peer_discovery, query_node_props, [[NodeB]],
infinity), infinity),
ct:pal("Discovered nodes properties:~n~p", [Ret]), ct:log("Discovered nodes properties:~n~p", [Ret]),
?assertMatch([{NodeB, [NodeB], _, false}], Ret), ?assertMatch([{NodeB, [NodeB], _, false}], Ret),
%% Ensure no connection exists after the query. %% Ensure no connection exists after the query.
@ -236,23 +236,23 @@ start_test_nodes(Testcase, NodeNumber, NodeCount, PeerOptions, Peers)
_ -> _ ->
PeerOptions1 PeerOptions1
end, end,
ct:pal("Starting peer with options: ~p", [PeerOptions2]), ct:log("Starting peer with options: ~p", [PeerOptions2]),
case catch peer:start(PeerOptions2) of case catch peer:start(PeerOptions2) of
{ok, PeerPid, PeerName} -> {ok, PeerPid, PeerName} ->
ct:pal("Configuring peer '~ts'", [PeerName]), ct:log("Configuring peer '~ts'", [PeerName]),
setup_test_node(PeerPid, PeerOptions2), setup_test_node(PeerPid, PeerOptions2),
Peers1 = Peers#{PeerName => PeerPid}, Peers1 = Peers#{PeerName => PeerPid},
start_test_nodes( start_test_nodes(
Testcase, NodeNumber + 1, NodeCount, PeerOptions, Peers1); Testcase, NodeNumber + 1, NodeCount, PeerOptions, Peers1);
Error -> Error ->
ct:pal("Failed to started peer node:~n" ct:log("Failed to started peer node:~n"
"Options: ~p~n" "Options: ~p~n"
"Error: ~p", [PeerOptions2, Error]), "Error: ~p", [PeerOptions2, Error]),
stop_test_nodes(Peers), stop_test_nodes(Peers),
erlang:throw(Error) erlang:throw(Error)
end; end;
start_test_nodes(_Testcase, _NodeNumber, _Count, _PeerOptions, Peers) -> start_test_nodes(_Testcase, _NodeNumber, _Count, _PeerOptions, Peers) ->
ct:pal("Peers: ~p", [Peers]), ct:log("Peers: ~p", [Peers]),
Peers. Peers.
setup_test_node(PeerPid, PeerOptions) -> setup_test_node(PeerPid, PeerOptions) ->

View File

@ -449,7 +449,7 @@ get_messages(Number, Ch, Q) ->
end. end.
check_policy_value(Server, QName, Value) -> check_policy_value(Server, QName, Value) ->
ct:pal("QUEUES ~p", ct:log("QUEUES ~p",
[rpc:call(Server, rabbit_amqqueue, list, [])]), [rpc:call(Server, rabbit_amqqueue, list, [])]),
{ok, Q} = rpc:call(Server, rabbit_amqqueue, lookup, [rabbit_misc:r(<<"/">>, queue, QName)]), {ok, Q} = rpc:call(Server, rabbit_amqqueue, lookup, [rabbit_misc:r(<<"/">>, queue, QName)]),
case rpc:call(Server, rabbit_policy, effective_definition, [Q]) of case rpc:call(Server, rabbit_policy, effective_definition, [Q]) of

View File

@ -43,7 +43,7 @@ command_with_output(Command, Node, Args, Opts) ->
Mod = 'Elixir.RabbitMQCtl', %% To silence a Dialyzer warning. Mod = 'Elixir.RabbitMQCtl', %% To silence a Dialyzer warning.
CommandResult = Mod:exec_command( CommandResult = Mod:exec_command(
Formatted, fun(Output,_,_) -> Output end), Formatted, fun(Output,_,_) -> Output end),
ct:pal("Executed command ~tp against node ~tp~nResult: ~tp~n", [Formatted, Node, CommandResult]), ct:log("Executed command ~tp against node ~tp~nResult: ~tp~n", [Formatted, Node, CommandResult]),
CommandResult. CommandResult.
format_command(Command, Node, Args, Opts) -> format_command(Command, Node, Args, Opts) ->

View File

@ -944,7 +944,7 @@ does_use_expected_metadata_store(Config, NodeConfig) ->
true -> khepri; true -> khepri;
false -> mnesia false -> mnesia
end, end,
ct:pal( ct:log(
"Metadata store on ~s: expected=~s, used=~s", "Metadata store on ~s: expected=~s, used=~s",
[Nodename, ExpectedMetadataStore, UsedMetadataStore]), [Nodename, ExpectedMetadataStore, UsedMetadataStore]),
{ExpectedMetadataStore, UsedMetadataStore}. {ExpectedMetadataStore, UsedMetadataStore}.
@ -975,7 +975,7 @@ cluster_nodes(Config, Nodes) when is_list(Nodes) ->
{value, SecNodeConfig} -> {value, SecNodeConfig} ->
NodeConfigs1 = NodeConfigs -- [SecNodeConfig], NodeConfigs1 = NodeConfigs -- [SecNodeConfig],
Nodename = ?config(nodename, SecNodeConfig), Nodename = ?config(nodename, SecNodeConfig),
ct:pal( ct:log(
"Using secondary-umbrella-based node ~s as the cluster seed " "Using secondary-umbrella-based node ~s as the cluster seed "
"node", "node",
[Nodename]), [Nodename]),
@ -984,7 +984,7 @@ cluster_nodes(Config, Nodes) when is_list(Nodes) ->
case NodeConfigs of case NodeConfigs of
[NodeConfig, SeedNodeConfig | NodeConfigs1] -> [NodeConfig, SeedNodeConfig | NodeConfigs1] ->
Nodename = ?config(nodename, SeedNodeConfig), Nodename = ?config(nodename, SeedNodeConfig),
ct:pal( ct:log(
"Using node ~s as the cluster seed node", "Using node ~s as the cluster seed node",
[Nodename]), [Nodename]),
cluster_nodes1( cluster_nodes1(
@ -1184,7 +1184,7 @@ ra_last_applied(ServerId) ->
do_nodes_run_same_ra_machine_version(Config, RaMachineMod) -> do_nodes_run_same_ra_machine_version(Config, RaMachineMod) ->
[MacVer1 | MacVerN] = MacVers = rpc_all(Config, RaMachineMod, version, []), [MacVer1 | MacVerN] = MacVers = rpc_all(Config, RaMachineMod, version, []),
ct:pal("Ra machine versions of ~s: ~0p", [RaMachineMod, MacVers]), ct:log("Ra machine versions of ~s: ~0p", [RaMachineMod, MacVers]),
is_integer(MacVer1) andalso is_integer(MacVer1) andalso
lists:all(fun(MacVer) -> MacVer =:= MacVer1 end, MacVerN). lists:all(fun(MacVer) -> MacVer =:= MacVer1 end, MacVerN).
@ -1403,7 +1403,7 @@ capture_gen_server_termination(
lists:reverse(Acc), Rest, Count, IgnoredCrashes). lists:reverse(Acc), Rest, Count, IgnoredCrashes).
found_gen_server_termiation(Message, Lines, Count, IgnoredCrashes) -> found_gen_server_termiation(Message, Lines, Count, IgnoredCrashes) ->
ct:pal("gen_server termination:~n~n~s", [Message]), ct:log("gen_server termination:~n~n~s", [Message]),
count_gen_server_terminations(Lines, Count + 1, IgnoredCrashes). count_gen_server_terminations(Lines, Count + 1, IgnoredCrashes).
%% ------------------------------------------------------------------- %% -------------------------------------------------------------------