Skip to content

Commit a7ed4cf

Browse files
Merge pull request #13482 from rabbitmq/mergify/bp/v4.0.x/pr-13481
Fix flake in test case session_upgrade_v3_v5_qos1 (backport #13480) (backport #13481)
2 parents b18d981 + 23596cf commit a7ed4cf

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

deps/rabbitmq_mqtt/test/v5_SUITE.erl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,17 +1020,27 @@ session_upgrade_v3_v5_qos0(Config) ->
10201020
session_upgrade_v3_v5_qos(Qos, Config) ->
10211021
ClientId = Topic = atom_to_binary(?FUNCTION_NAME),
10221022
Pub = connect(<<"publisher">>, Config),
1023-
Subv3 = connect(ClientId, Config, [{proto_ver, v3} | non_clean_sess_opts()]),
1023+
Subv3 = connect(ClientId, Config,
1024+
[{proto_ver, v3},
1025+
{auto_ack, false}] ++
1026+
non_clean_sess_opts()),
10241027
?assertEqual(3, proplists:get_value(proto_ver, emqtt:info(Subv3))),
10251028
{ok, _, [Qos]} = emqtt:subscribe(Subv3, Topic, Qos),
10261029
Sender = spawn_link(?MODULE, send, [self(), Pub, Topic, 0]),
10271030
receive {publish, #{payload := <<"1">>,
1028-
client_pid := Subv3}} -> ok
1031+
client_pid := Subv3,
1032+
packet_id := PacketId}} ->
1033+
case Qos of
1034+
0 -> ok;
1035+
1 -> emqtt:puback(Subv3, PacketId)
1036+
end
10291037
after ?TIMEOUT -> ct:fail("did not receive 1")
10301038
end,
10311039
%% Upgrade session from v3 to v5 while another client is sending messages.
10321040
ok = emqtt:disconnect(Subv3),
1033-
Subv5 = connect(ClientId, Config, [{proto_ver, v5}, {clean_start, false}]),
1041+
Subv5 = connect(ClientId, Config, [{proto_ver, v5},
1042+
{clean_start, false},
1043+
{auto_ack, true}]),
10341044
?assertEqual(5, proplists:get_value(proto_ver, emqtt:info(Subv5))),
10351045
Sender ! stop,
10361046
NumSent = receive {N, Sender} -> N

0 commit comments

Comments
 (0)