fix(test): ci failed due to existing subscriptions

This commit is contained in:
Shawn 2021-06-16 10:37:11 +08:00 committed by turtleDeng
parent 444c721f93
commit 8b0a6d955b
1 changed files with 15 additions and 15 deletions

View File

@ -41,6 +41,21 @@ end_per_suite(_Config) ->
%% PubSub Test
%%--------------------------------------------------------------------
t_stats_fun(_) ->
?assertEqual(0, emqx_stats:getstat('subscribers.count')),
?assertEqual(0, emqx_stats:getstat('subscriptions.count')),
?assertEqual(0, emqx_stats:getstat('suboptions.count')),
ok = emqx_broker:subscribe(<<"topic">>, <<"clientid">>),
ok = emqx_broker:subscribe(<<"topic2">>, <<"clientid">>),
emqx_broker:stats_fun(),
ct:sleep(10),
?assertEqual(2, emqx_stats:getstat('subscribers.count')),
?assertEqual(2, emqx_stats:getstat('subscribers.max')),
?assertEqual(2, emqx_stats:getstat('subscriptions.count')),
?assertEqual(2, emqx_stats:getstat('subscriptions.max')),
?assertEqual(2, emqx_stats:getstat('suboptions.count')),
?assertEqual(2, emqx_stats:getstat('suboptions.max')).
t_subscribed(_) ->
emqx_broker:subscribe(<<"topic">>),
?assertEqual(false, emqx_broker:subscribed(undefined, <<"topic">>)),
@ -191,21 +206,6 @@ t_shard(_) ->
end),
ok = meck:unload(emqx_broker_helper).
t_stats_fun(_) ->
?assertEqual(0, emqx_stats:getstat('subscribers.count')),
?assertEqual(0, emqx_stats:getstat('subscriptions.count')),
?assertEqual(0, emqx_stats:getstat('suboptions.count')),
ok = emqx_broker:subscribe(<<"topic">>, <<"clientid">>),
ok = emqx_broker:subscribe(<<"topic2">>, <<"clientid">>),
emqx_broker:stats_fun(),
ct:sleep(10),
?assertEqual(2, emqx_stats:getstat('subscribers.count')),
?assertEqual(2, emqx_stats:getstat('subscribers.max')),
?assertEqual(2, emqx_stats:getstat('subscriptions.count')),
?assertEqual(2, emqx_stats:getstat('subscriptions.max')),
?assertEqual(2, emqx_stats:getstat('suboptions.count')),
?assertEqual(2, emqx_stats:getstat('suboptions.max')).
recv_msgs(Count) ->
recv_msgs(Count, []).