Merge pull request #7312 from savonarola/fix-retainer-tests
chore(retainer): fix mqtt_v5 test suite
This commit is contained in:
commit
402cb9190f
|
@ -53,9 +53,6 @@ init_per_suite(Config) ->
|
|||
application:load(emqx_conf),
|
||||
ok = ekka:start(),
|
||||
ok = mria_rlog:wait_for_shards([?CLUSTER_RPC_SHARD], infinity),
|
||||
meck:new(emqx_alarm, [non_strict, passthrough, no_link]),
|
||||
meck:expect(emqx_alarm, activate, 3, ok),
|
||||
meck:expect(emqx_alarm, deactivate, 3, ok),
|
||||
|
||||
load_base_conf(),
|
||||
emqx_ratelimiter_SUITE:base_conf(),
|
||||
|
@ -66,7 +63,6 @@ end_per_suite(_Config) ->
|
|||
ekka:stop(),
|
||||
mria:stop(),
|
||||
mria_mnesia:delete_schema(),
|
||||
meck:unload(emqx_alarm),
|
||||
|
||||
emqx_common_test_helpers:stop_apps([emqx_retainer]).
|
||||
|
||||
|
@ -75,15 +71,6 @@ init_per_testcase(_, Config) ->
|
|||
timer:sleep(200),
|
||||
Config.
|
||||
|
||||
end_per_testcase(_, Config) ->
|
||||
case erlang:whereis(node()) of
|
||||
undefined -> ok;
|
||||
P ->
|
||||
erlang:unlink(P),
|
||||
erlang:exit(P, kill)
|
||||
end,
|
||||
Config.
|
||||
|
||||
load_base_conf() ->
|
||||
ok = emqx_common_test_helpers:load_config(emqx_retainer_schema, ?BASE_CONF).
|
||||
|
||||
|
@ -295,7 +282,9 @@ t_stop_publish_clear_msg(_) ->
|
|||
|
||||
t_flow_control(_) ->
|
||||
#{per_client := PerClient} = RetainerCfg = emqx_config:get([limiter, shared, bucket, retainer]),
|
||||
RetainerCfg2 = RetainerCfg#{per_client := PerClient#{rate := emqx_ratelimiter_SUITE:to_rate("1/1s"),
|
||||
RetainerCfg2 = RetainerCfg#{
|
||||
per_client := PerClient#{
|
||||
rate := emqx_ratelimiter_SUITE:to_rate("1/1s"),
|
||||
capacity := 1}},
|
||||
emqx_config:put([limiter, shared, bucket, retainer], RetainerCfg2),
|
||||
emqx_limiter_manager:restart_server(shared),
|
||||
|
@ -347,7 +336,8 @@ t_flow_control(_) ->
|
|||
|
||||
t_clear_expired(_) ->
|
||||
ConfMod = fun(Conf) ->
|
||||
Conf#{<<"msg_clear_interval">> := <<"1s">>, <<"msg_expiry_interval">> := <<"3s">>}
|
||||
Conf#{<<"msg_clear_interval">> := <<"1s">>,
|
||||
<<"msg_expiry_interval">> := <<"3s">>}
|
||||
end,
|
||||
|
||||
Case = fun() ->
|
||||
|
|
|
@ -22,37 +22,22 @@
|
|||
-include_lib("eunit/include/eunit.hrl").
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
-define(CLUSTER_RPC_SHARD, emqx_cluster_rpc_shard).
|
||||
-import(emqx_mgmt_api_test_util, [request_api/2, request_api/5, api_path/1, auth_header_/0]).
|
||||
|
||||
all() ->
|
||||
emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
application:load(emqx_conf),
|
||||
ok = ekka:start(),
|
||||
ok = mria_rlog:wait_for_shards([?CLUSTER_RPC_SHARD], infinity),
|
||||
meck:new(emqx_alarm, [non_strict, passthrough, no_link]),
|
||||
meck:expect(emqx_alarm, activate, 3, ok),
|
||||
meck:expect(emqx_alarm, deactivate, 3, ok),
|
||||
|
||||
application:stop(emqx_retainer),
|
||||
emqx_retainer_SUITE:load_base_conf(),
|
||||
emqx_mgmt_api_test_util:init_suite([emqx_retainer]),
|
||||
Config.
|
||||
|
||||
end_per_suite(Config) ->
|
||||
ekka:stop(),
|
||||
mria:stop(),
|
||||
mria_mnesia:delete_schema(),
|
||||
meck:unload(emqx_alarm),
|
||||
emqx_mgmt_api_test_util:end_suite([emqx_slow_subs]),
|
||||
emqx_mgmt_api_test_util:end_suite([emqx_retainer]),
|
||||
Config.
|
||||
|
||||
init_per_testcase(_, Config) ->
|
||||
{ok, _} = emqx_cluster_rpc:start_link(),
|
||||
application:ensure_all_started(emqx_retainer),
|
||||
timer:sleep(500),
|
||||
Config.
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
|
|
|
@ -21,19 +21,15 @@
|
|||
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
all() -> [].
|
||||
%% emqx_common_test_helpers:all(?MODULE).
|
||||
all() -> emqx_common_test_helpers:all(?MODULE).
|
||||
|
||||
init_per_suite(Config) ->
|
||||
emqx_retainer_SUITE:load_base_conf(),
|
||||
%% Meck emqtt
|
||||
ok = meck:new(emqtt, [non_strict, passthrough, no_history, no_link]),
|
||||
%% Start Apps
|
||||
emqx_common_test_helpers:start_apps([emqx_retainer]),
|
||||
Config.
|
||||
|
||||
end_per_suite(_Config) ->
|
||||
ok = meck:unload(emqtt),
|
||||
emqx_common_test_helpers:stop_apps([emqx_retainer]).
|
||||
|
||||
client_info(Key, Client) ->
|
||||
|
|
Loading…
Reference in New Issue