Fix the coverage shaky (#2010)

This commit is contained in:
Gilbert 2018-11-30 19:16:48 +08:00 committed by GitHub
parent 29f697dd69
commit 295a9d692e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -33,6 +33,11 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
code_change/3]).
-ifdef(TEST).
-compile(export_all).
-compile(nowarn_export_all).
-endif.
-record(state, {pool, id, submap, submon}).
-record(subscribe, {topic, subpid, subid, subopts = #{}}).
-record(unsubscribe, {topic, subpid, subid}).

View File

@ -38,6 +38,7 @@ groups() ->
publish, pubsub,
t_local_subscribe,
t_shared_subscribe,
dispatch_with_no_sub,
'pubsub#', 'pubsub+']},
{session, [sequence], [start_session]},
{metrics, [sequence], [inc_dec_metric]},
@ -76,6 +77,11 @@ publish(_) ->
emqx:publish(Msg),
?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(_) ->
true = emqx:is_running(node()),
Self = self(),
@ -193,4 +199,3 @@ set_alarms(_) ->
?assertEqual(1, length(Alarms)),
emqx_alarm_mgr:clear_alarm(<<"1">>),
[] = emqx_alarm_mgr:get_alarms().