Local shovels: Set default user/pass for uris like "amqp://"

This commit is contained in:
Diana Parra Corbacho 2025-08-25 11:26:03 +02:00
parent c7f6cad331
commit f990f7e271
2 changed files with 24 additions and 2 deletions

View File

@ -546,7 +546,13 @@ get_user_vhost_from_amqp_param(Uri) ->
#amqp_params_direct{username = U, #amqp_params_direct{username = U,
password = P, password = P,
virtual_host = V} -> virtual_host = V} ->
{U, P, V}; case {U, P} of
{none, none} ->
%% Default user for uris like amqp://
{<<"guest">>, <<"guest">>, V};
_ ->
{U, P, V}
end;
#amqp_params_network{username = U, #amqp_params_network{username = U,
password = P, password = P,
virtual_host = V} -> virtual_host = V} ->

View File

@ -76,7 +76,8 @@ groups() ->
local_to_local_quorum_credit_flow_no_ack, local_to_local_quorum_credit_flow_no_ack,
local_to_local_stream_credit_flow_on_confirm, local_to_local_stream_credit_flow_on_confirm,
local_to_local_stream_credit_flow_on_publish, local_to_local_stream_credit_flow_on_publish,
local_to_local_stream_credit_flow_no_ack local_to_local_stream_credit_flow_no_ack,
local_to_local_simple_uri
]} ]}
]. ].
@ -1029,6 +1030,21 @@ local_to_local_stream_credit_flow(Config, AckMode) ->
amqp10_client:detach_link(Receiver) amqp10_client:detach_link(Receiver)
end). end).
local_to_local_simple_uri(Config) ->
Src = ?config(srcq, Config),
Dest = ?config(destq, Config),
AltVHost = ?config(alt_vhost, Config),
Uri = <<"amqp://">>,
ok = rabbit_ct_broker_helpers:rpc(
Config, 0, rabbit_runtime_parameters, set,
[<<"/">>, <<"shovel">>, ?PARAM, [{<<"src-uri">>, Uri},
{<<"dest-uri">>, [Uri]},
{<<"src-protocol">>, <<"local">>},
{<<"src-queue">>, Src},
{<<"dest-protocol">>, <<"local">>},
{<<"dest-queue">>, Dest}],
none]),
shovel_test_utils:await_shovel(Config, ?PARAM).
%%---------------------------------------------------------------------------- %%----------------------------------------------------------------------------
with_session(Config, Fun) -> with_session(Config, Fun) ->