Skip to content

Commit 67ac485

Browse files
committed
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.
1 parent bd74503 commit 67ac485

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

deps/rabbitmq_stream/src/rabbit_stream_reader.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ handle_frame_post_auth(Transport,
15781578
S1,
15791579
{request, CorrelationId,
15801580
{sasl_authenticate, NewMechanism, NewSaslBin}}) ->
1581-
?LOG_DEBUG("Open frame received sasl_authenticate for username '~ts'", [Username]),
1581+
?LOG_DEBUG("Received sasl_authenticate for username '~ts'", [Username]),
15821582

15831583
{Connection1, State1} =
15841584
case Auth_Mechanism of

deps/rabbitmq_stream/test/rabbit_stream_SUITE.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ cannot_use_another_authmechanism_when_updating_secret(Config) ->
322322
update_secret_should_close_connection_if_wrong_secret(Config) ->
323323
Transport = gen_tcp,
324324
{S, C0} = connect_and_authenticate(Transport, Config),
325-
Pwd = rand:bytes(20),
325+
Pwd = rand_bin(),
326326
_C1 = expect_unsuccessful_authentication(
327327
try_authenticate(Transport, S, C0, <<"PLAIN">>, <<"guest">>, Pwd),
328328
?RESPONSE_AUTHENTICATION_FAILURE),
@@ -1214,7 +1214,7 @@ test_connection_properties_with_advertised_hints(Config) ->
12141214

12151215
lists:foreach(
12161216
fun(Transport) ->
1217-
AdHost = rand:bytes(20),
1217+
AdHost = rand_bin(),
12181218
AdPort = rand:uniform(65535),
12191219
{KH, KP} = case Transport of
12201220
gen_tcp ->
@@ -1770,3 +1770,6 @@ request(Cmd) ->
17701770

17711771
request(CorrId, Cmd) ->
17721772
rabbit_stream_core:frame({request, CorrId, Cmd}).
1773+
1774+
rand_bin() ->
1775+
base64:encode(rand:bytes(20)).

0 commit comments

Comments
 (0)