test: comment the will message cases

This commit is contained in:
Turtle 2020-12-04 21:39:27 +08:00 committed by turtleDeng
parent 7462ed92ba
commit f8369f5280
1 changed files with 57 additions and 53 deletions

View File

@ -328,59 +328,63 @@ t_connect_session_expiry_interval(_) ->
ok = emqtt:disconnect(Client3).
%% [MQTT-3.1.3-9]
t_connect_will_delay_interval(_) ->
process_flag(trap_exit, true),
Topic = nth(1, ?TOPICS),
Payload = "will message",
{ok, Client1} = emqtt:start_link([{proto_ver, v5}]),
{ok, _} = emqtt:connect(Client1),
{ok, _, [2]} = emqtt:subscribe(Client1, Topic, qos2),
{ok, Client2} = emqtt:start_link([
{clientid, <<"t_connect_will_delay_interval">>},
{proto_ver, v5},
{clean_start, true},
{will_flag, true},
{will_qos, 2},
{will_topic, Topic},
{will_payload, Payload},
{will_props, #{'Will-Delay-Interval' => 3}},
{properties, #{'Session-Expiry-Interval' => 7200}},
{keepalive, 2}
]),
{ok, _} = emqtt:connect(Client2),
timer:sleep(5000),
?assertEqual(0, length(receive_messages(1))),
timer:sleep(7000),
?assertEqual(1, length(receive_messages(1))),
{ok, Client3} = emqtt:start_link([
{clientid, <<"t_connect_will_delay_interval">>},
{proto_ver, v5},
{clean_start, true},
{will_flag, true},
{will_qos, 2},
{will_topic, Topic},
{will_payload, Payload},
{will_props, #{'Will-Delay-Interval' => 7200}},
{properties, #{'Session-Expiry-Interval' => 3}},
{keepalive, 2}
]),
{ok, _} = emqtt:connect(Client3),
timer:sleep(5000),
?assertEqual(0, length(receive_messages(1))),
timer:sleep(7000),
?assertEqual(1, length(receive_messages(1))),
ok = emqtt:disconnect(Client1),
receive {'EXIT', _, _} -> ok
after 100 -> ok
end,
process_flag(trap_exit, false).
%% !!!REFACTOR NEED:
%t_connect_will_delay_interval(_) ->
% process_flag(trap_exit, true),
% Topic = nth(1, ?TOPICS),
% Payload = "will message",
%
% {ok, Client1} = emqtt:start_link([{proto_ver, v5}]),
% {ok, _} = emqtt:connect(Client1),
% {ok, _, [2]} = emqtt:subscribe(Client1, Topic, qos2),
%
% {ok, Client2} = emqtt:start_link([
% {clientid, <<"t_connect_will_delay_interval">>},
% {proto_ver, v5},
% {clean_start, true},
% {will_flag, true},
% {will_qos, 2},
% {will_topic, Topic},
% {will_payload, Payload},
% {will_props, #{'Will-Delay-Interval' => 3}},
% {properties, #{'Session-Expiry-Interval' => 7200}},
% {keepalive, 2}
% ]),
% {ok, _} = emqtt:connect(Client2),
% timer:sleep(50),
% erlang:exit(Client2, kill),
% timer:sleep(2000),
% ?assertEqual(0, length(receive_messages(1))),
% timer:sleep(5000),
% ?assertEqual(1, length(receive_messages(1))),
%
% {ok, Client3} = emqtt:start_link([
% {clientid, <<"t_connect_will_delay_interval">>},
% {proto_ver, v5},
% {clean_start, true},
% {will_flag, true},
% {will_qos, 2},
% {will_topic, Topic},
% {will_payload, Payload},
% {will_props, #{'Will-Delay-Interval' => 7200}},
% {properties, #{'Session-Expiry-Interval' => 3}},
% {keepalive, 2}
% ]),
% {ok, _} = emqtt:connect(Client3),
% timer:sleep(50),
% erlang:exit(Client3, kill),
%
% timer:sleep(2000),
% ?assertEqual(0, length(receive_messages(1))),
% timer:sleep(5000),
% ?assertEqual(1, length(receive_messages(1))),
%
% ok = emqtt:disconnect(Client1),
%
% receive {'EXIT', _, _} -> ok
% after 100 -> ok
% end,
% process_flag(trap_exit, false).
%% [MQTT-3.1.4-3]
t_connect_duplicate_clientid(_) ->