Fix the test suites.
This commit is contained in:
parent
52b2f31ced
commit
ae33b6037e
|
@ -177,7 +177,6 @@ websocket_init([Req, Opts]) ->
|
|||
MaxSize = emqx_zone:get_env(Zone, max_packet_size, ?MAX_PACKET_SIZE),
|
||||
ParseState = emqx_frame:initial_parse_state(#{max_size => MaxSize}),
|
||||
emqx_logger:set_metadata_peername(esockd_net:format(Peername)),
|
||||
ok = emqx_misc:init_proc_mng_policy(Zone),
|
||||
{ok, #state{peername = Peername,
|
||||
sockname = Sockname,
|
||||
fsm_state = idle,
|
||||
|
|
|
@ -166,9 +166,9 @@ t_handle_deliver(_) ->
|
|||
= handle_in(?SUBSCRIBE_PACKET(1, #{}, TopicFilters), Channel),
|
||||
Msg0 = emqx_message:make(<<"clientx">>, ?QOS_0, <<"t0">>, <<"qos0">>),
|
||||
Msg1 = emqx_message:make(<<"clientx">>, ?QOS_1, <<"t1">>, <<"qos1">>),
|
||||
Delivers = [{deliver, <<"+">>, Msg0},
|
||||
{deliver, <<"+">>, Msg1}],
|
||||
{ok, Packets, _Channel2} = emqx_channel:handle_deliver(Delivers, Channel1),
|
||||
%% TODO: Fixme later.
|
||||
self() ! {deliver, <<"+">>, Msg1},
|
||||
{ok, Packets, _Channel2} = emqx_channel:handle_out({deliver, <<"+">>, Msg0}, Channel1),
|
||||
?assertMatch([?PUBLISH_PACKET(?QOS_0, <<"t0">>, undefined, <<"qos0">>),
|
||||
?PUBLISH_PACKET(?QOS_1, <<"t1">>, 1, <<"qos1">>)
|
||||
], Packets)
|
||||
|
@ -183,7 +183,7 @@ t_handle_conack(_) ->
|
|||
fun(Channel) ->
|
||||
{ok, ?CONNACK_PACKET(?RC_SUCCESS, SP, _), _}
|
||||
= handle_out(connack, {?RC_SUCCESS, 0}, Channel),
|
||||
{error, unauthorized_client, ?CONNACK_PACKET(5), _}
|
||||
{stop, {shutdown, unauthorized_client}, ?CONNACK_PACKET(5), _}
|
||||
= handle_out(connack, ?RC_NOT_AUTHORIZED, Channel)
|
||||
end).
|
||||
|
||||
|
|
|
@ -55,26 +55,6 @@ t_timer_cancel_flush() ->
|
|||
after 0 -> ok
|
||||
end.
|
||||
|
||||
t_shutdown_disabled() ->
|
||||
ok = drain(),
|
||||
self() ! foo,
|
||||
?assertEqual(continue, emqx_misc:conn_proc_mng_policy(0)),
|
||||
receive foo -> ok end,
|
||||
?assertEqual(hibernate, emqx_misc:conn_proc_mng_policy(0)).
|
||||
|
||||
t_message_queue_too_long() ->
|
||||
ok = drain(),
|
||||
self() ! foo,
|
||||
self() ! bar,
|
||||
?assertEqual({shutdown, message_queue_too_long},
|
||||
emqx_misc:conn_proc_mng_policy(1)),
|
||||
receive foo -> ok end,
|
||||
?assertEqual(continue, emqx_misc:conn_proc_mng_policy(1)),
|
||||
receive bar -> ok end.
|
||||
|
||||
t_conn_proc_mng_policy(L) ->
|
||||
emqx_misc:conn_proc_mng_policy(#{message_queue_len => L}).
|
||||
|
||||
t_proc_name(_) ->
|
||||
'TODO'.
|
||||
|
||||
|
|
|
@ -24,11 +24,23 @@
|
|||
all() -> emqx_ct:all(?MODULE).
|
||||
|
||||
t_init(_) ->
|
||||
'TODO'.
|
||||
?assertEqual(undefined, emqx_oom:init(undefined)),
|
||||
Opts = #{message_queue_len => 10,
|
||||
max_heap_size => 1024*1024*8
|
||||
},
|
||||
Oom = emqx_oom:init(Opts),
|
||||
?assertEqual(#{message_queue_len => 10,
|
||||
max_heap_size => 1024*1024
|
||||
}, emqx_oom:info(Oom)).
|
||||
|
||||
t_check(_) ->
|
||||
'TODO'.
|
||||
|
||||
t_info(_) ->
|
||||
'TODO'.
|
||||
?assertEqual(ok, emqx_oom:check(undefined)),
|
||||
Opts = #{message_queue_len => 10,
|
||||
max_heap_size => 1024*1024*8
|
||||
},
|
||||
Oom = emqx_oom:init(Opts),
|
||||
[self() ! {msg, I} || I <- lists:seq(1, 5)],
|
||||
?assertEqual(ok, emqx_oom:check(Oom)),
|
||||
[self() ! {msg, I} || I <- lists:seq(1, 6)],
|
||||
?assertEqual({shutdown, message_queue_too_long}, emqx_oom:check(Oom)).
|
||||
|
||||
|
|
Loading…
Reference in New Issue