test(sessmem): drop unnecessary nesting in testcase

Also get rid of sneaky binding assignment.
This commit is contained in:
Andrew Mayorov 2023-09-19 18:03:32 +04:00
parent 98706cd215
commit 9362ef6f73
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 27 additions and 29 deletions

View File

@ -178,8 +178,8 @@ t_publish_qos2_with_error_return(_) ->
ok ok
end), end),
Session = session(#{max_awaiting_rel => 2, awaiting_rel => #{PacketId1 = 1 => ts(millisecond)}}), PacketId1 = 1,
begin Session = session(#{max_awaiting_rel => 2, awaiting_rel => #{PacketId1 => ts(millisecond)}}),
Msg1 = emqx_message:make(clientid, ?QOS_2, <<"t">>, <<"payload1">>), Msg1 = emqx_message:make(clientid, ?QOS_2, <<"t">>, <<"payload1">>),
{error, RC1 = ?RC_PACKET_IDENTIFIER_IN_USE} = emqx_session:publish( {error, RC1 = ?RC_PACKET_IDENTIFIER_IN_USE} = emqx_session:publish(
clientinfo(), PacketId1, Msg1, Session clientinfo(), PacketId1, Msg1, Session
@ -190,10 +190,8 @@ t_publish_qos2_with_error_return(_) ->
?assertEqual(RecMsg1, Msg1) ?assertEqual(RecMsg1, Msg1)
after 1000 -> after 1000 ->
ct:fail(?FUNCTION_NAME) ct:fail(?FUNCTION_NAME)
end
end, end,
begin
Msg2 = emqx_message:make(clientid, ?QOS_2, <<"t">>, <<"payload2">>), Msg2 = emqx_message:make(clientid, ?QOS_2, <<"t">>, <<"payload2">>),
{ok, [], Session1} = emqx_session:publish( {ok, [], Session1} = emqx_session:publish(
clientinfo(), _PacketId2 = 2, Msg2, Session clientinfo(), _PacketId2 = 2, Msg2, Session
@ -208,8 +206,8 @@ t_publish_qos2_with_error_return(_) ->
?assertEqual(RecMsg2, Msg2) ?assertEqual(RecMsg2, Msg2)
after 1000 -> after 1000 ->
ct:fail(?FUNCTION_NAME) ct:fail(?FUNCTION_NAME)
end
end, end,
ok = meck:expect(emqx_hooks, run, fun(_Hook, _Args) -> ok end). ok = meck:expect(emqx_hooks, run, fun(_Hook, _Args) -> ok end).
t_is_awaiting_full_false(_) -> t_is_awaiting_full_false(_) ->