Use base64 encoding for random binary in test

The random binary contains characters that can make an authentication
test fail. Encoding it in base64 fixes the problem.
This commit is contained in:
Arnaud Cogoluègnes 2025-09-04 09:35:12 +00:00
parent bd7450342e
commit 67ac485e74
No known key found for this signature in database
GPG Key ID: D5C8C4DFAD43AFA8
2 changed files with 6 additions and 3 deletions

View File

@ -1578,7 +1578,7 @@ handle_frame_post_auth(Transport,
S1, S1,
{request, CorrelationId, {request, CorrelationId,
{sasl_authenticate, NewMechanism, NewSaslBin}}) -> {sasl_authenticate, NewMechanism, NewSaslBin}}) ->
?LOG_DEBUG("Open frame received sasl_authenticate for username '~ts'", [Username]), ?LOG_DEBUG("Received sasl_authenticate for username '~ts'", [Username]),
{Connection1, State1} = {Connection1, State1} =
case Auth_Mechanism of case Auth_Mechanism of

View File

@ -322,7 +322,7 @@ cannot_use_another_authmechanism_when_updating_secret(Config) ->
update_secret_should_close_connection_if_wrong_secret(Config) -> update_secret_should_close_connection_if_wrong_secret(Config) ->
Transport = gen_tcp, Transport = gen_tcp,
{S, C0} = connect_and_authenticate(Transport, Config), {S, C0} = connect_and_authenticate(Transport, Config),
Pwd = rand:bytes(20), Pwd = rand_bin(),
_C1 = expect_unsuccessful_authentication( _C1 = expect_unsuccessful_authentication(
try_authenticate(Transport, S, C0, <<"PLAIN">>, <<"guest">>, Pwd), try_authenticate(Transport, S, C0, <<"PLAIN">>, <<"guest">>, Pwd),
?RESPONSE_AUTHENTICATION_FAILURE), ?RESPONSE_AUTHENTICATION_FAILURE),
@ -1214,7 +1214,7 @@ test_connection_properties_with_advertised_hints(Config) ->
lists:foreach( lists:foreach(
fun(Transport) -> fun(Transport) ->
AdHost = rand:bytes(20), AdHost = rand_bin(),
AdPort = rand:uniform(65535), AdPort = rand:uniform(65535),
{KH, KP} = case Transport of {KH, KP} = case Transport of
gen_tcp -> gen_tcp ->
@ -1770,3 +1770,6 @@ request(Cmd) ->
request(CorrId, Cmd) -> request(CorrId, Cmd) ->
rabbit_stream_core:frame({request, CorrId, Cmd}). rabbit_stream_core:frame({request, CorrId, Cmd}).
rand_bin() ->
base64:encode(rand:bytes(20)).