Fix the coverage shaky (#2010)
This commit is contained in:
parent
29f697dd69
commit
295a9d692e
|
@ -33,6 +33,11 @@
|
||||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
|
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
|
||||||
code_change/3]).
|
code_change/3]).
|
||||||
|
|
||||||
|
-ifdef(TEST).
|
||||||
|
-compile(export_all).
|
||||||
|
-compile(nowarn_export_all).
|
||||||
|
-endif.
|
||||||
|
|
||||||
-record(state, {pool, id, submap, submon}).
|
-record(state, {pool, id, submap, submon}).
|
||||||
-record(subscribe, {topic, subpid, subid, subopts = #{}}).
|
-record(subscribe, {topic, subpid, subid, subopts = #{}}).
|
||||||
-record(unsubscribe, {topic, subpid, subid}).
|
-record(unsubscribe, {topic, subpid, subid}).
|
||||||
|
|
|
@ -38,6 +38,7 @@ groups() ->
|
||||||
publish, pubsub,
|
publish, pubsub,
|
||||||
t_local_subscribe,
|
t_local_subscribe,
|
||||||
t_shared_subscribe,
|
t_shared_subscribe,
|
||||||
|
dispatch_with_no_sub,
|
||||||
'pubsub#', 'pubsub+']},
|
'pubsub#', 'pubsub+']},
|
||||||
{session, [sequence], [start_session]},
|
{session, [sequence], [start_session]},
|
||||||
{metrics, [sequence], [inc_dec_metric]},
|
{metrics, [sequence], [inc_dec_metric]},
|
||||||
|
@ -76,6 +77,11 @@ publish(_) ->
|
||||||
emqx:publish(Msg),
|
emqx:publish(Msg),
|
||||||
?assert(receive {dispatch, <<"test/+">>, Msg} -> true after 5 -> false end).
|
?assert(receive {dispatch, <<"test/+">>, Msg} -> true after 5 -> false end).
|
||||||
|
|
||||||
|
dispatch_with_no_sub(_) ->
|
||||||
|
Msg = emqx_message:make(ct, <<"no_subscribers">>, <<"hello">>),
|
||||||
|
Delivery = #delivery{sender = self(), message = Msg, results = []},
|
||||||
|
?assertEqual(Delivery, emqx_broker:route([{<<"no_subscribers">>, node()}], Delivery)).
|
||||||
|
|
||||||
pubsub(_) ->
|
pubsub(_) ->
|
||||||
true = emqx:is_running(node()),
|
true = emqx:is_running(node()),
|
||||||
Self = self(),
|
Self = self(),
|
||||||
|
@ -193,4 +199,3 @@ set_alarms(_) ->
|
||||||
?assertEqual(1, length(Alarms)),
|
?assertEqual(1, length(Alarms)),
|
||||||
emqx_alarm_mgr:clear_alarm(<<"1">>),
|
emqx_alarm_mgr:clear_alarm(<<"1">>),
|
||||||
[] = emqx_alarm_mgr:get_alarms().
|
[] = emqx_alarm_mgr:get_alarms().
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue