chore: Fix emqx_channel_SUITE meck orders

This commit is contained in:
Zaiming Shi 2021-03-25 22:19:53 +01:00 committed by Zaiming (Stone) Shi
parent e579c7624b
commit 5e2ba1cdc3
1 changed files with 5 additions and 8 deletions

View File

@ -58,14 +58,15 @@ end_per_suite(_Config) ->
emqx_session, emqx_session,
emqx_broker, emqx_broker,
emqx_hooks, emqx_hooks,
emqx_cm, emqx_cm
emqx_zone
]). ]).
init_per_testcase(_TestCase, Config) -> init_per_testcase(_TestCase, Config) ->
meck:new(emqx_zone, [passthrough, no_history, no_link]),
Config. Config.
end_per_testcase(_TestCase, Config) -> end_per_testcase(_TestCase, Config) ->
meck:unload([emqx_zone]),
Config. Config.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
@ -708,11 +709,9 @@ t_packing_alias(_) ->
channel())). channel())).
t_check_pub_acl(_) -> t_check_pub_acl(_) ->
ok = meck:new(emqx_zone, [passthrough, no_history]),
ok = meck:expect(emqx_zone, enable_acl, fun(_) -> true end), ok = meck:expect(emqx_zone, enable_acl, fun(_) -> true end),
Publish = ?PUBLISH_PACKET(?QOS_0, <<"t">>, 1, <<"payload">>), Publish = ?PUBLISH_PACKET(?QOS_0, <<"t">>, 1, <<"payload">>),
ok = emqx_channel:check_pub_acl(Publish, channel()), ok = emqx_channel:check_pub_acl(Publish, channel()).
ok = meck:unload(emqx_zone).
t_check_pub_alias(_) -> t_check_pub_alias(_) ->
Publish = #mqtt_packet_publish{topic_name = <<>>, properties = #{'Topic-Alias' => 1}}, Publish = #mqtt_packet_publish{topic_name = <<>>, properties = #{'Topic-Alias' => 1}},
@ -720,11 +719,9 @@ t_check_pub_alias(_) ->
ok = emqx_channel:check_pub_alias(#mqtt_packet{variable = Publish}, Channel). ok = emqx_channel:check_pub_alias(#mqtt_packet{variable = Publish}, Channel).
t_check_sub_acls(_) -> t_check_sub_acls(_) ->
ok = meck:new(emqx_zone, [passthrough, no_history]),
ok = meck:expect(emqx_zone, enable_acl, fun(_) -> true end), ok = meck:expect(emqx_zone, enable_acl, fun(_) -> true end),
TopicFilter = {<<"t">>, ?DEFAULT_SUBOPTS}, TopicFilter = {<<"t">>, ?DEFAULT_SUBOPTS},
[{TopicFilter, 0}] = emqx_channel:check_sub_acls([TopicFilter], channel()), [{TopicFilter, 0}] = emqx_channel:check_sub_acls([TopicFilter], channel()).
ok = meck:unload(emqx_zone).
t_enrich_connack_caps(_) -> t_enrich_connack_caps(_) ->
ok = meck:new(emqx_mqtt_caps, [passthrough, no_history]), ok = meck:new(emqx_mqtt_caps, [passthrough, no_history]),