Merge pull request #10866 from zhongwencool/add-delayed-test
test: add test for delayed update
This commit is contained in:
commit
ec580f0454
|
@ -1,7 +1,7 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{application, emqx_auto_subscribe, [
|
||||
{description, "Auto subscribe Application"},
|
||||
{vsn, "0.1.4"},
|
||||
{vsn, "0.1.5"},
|
||||
{registered, []},
|
||||
{mod, {emqx_auto_subscribe_app, []}},
|
||||
{applications, [
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
-include_lib("emqx/include/emqx_hooks.hrl").
|
||||
|
||||
-behaviour(emqx_config_handler).
|
||||
|
||||
-define(HOOK_POINT, 'client.connected').
|
||||
|
||||
-define(MAX_AUTO_SUBSCRIBE, 20).
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
-module(emqx_delayed).
|
||||
|
||||
-behaviour(gen_server).
|
||||
-behaviour(emqx_config_handler).
|
||||
|
||||
-include_lib("emqx/include/emqx.hrl").
|
||||
-include_lib("emqx/include/types.hrl").
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{application, emqx_modules, [
|
||||
{description, "EMQX Modules"},
|
||||
{vsn, "5.0.15"},
|
||||
{vsn, "5.0.16"},
|
||||
{modules, []},
|
||||
{applications, [kernel, stdlib, emqx, emqx_ctl]},
|
||||
{mod, {emqx_modules_app, []}},
|
||||
|
|
|
@ -274,3 +274,18 @@ subscribe_proc() ->
|
|||
2000
|
||||
end
|
||||
end.
|
||||
|
||||
t_delayed_load_unload(_Config) ->
|
||||
Conf = emqx:get_raw_config([delayed]),
|
||||
Conf1 = Conf#{<<"max_delayed_messages">> => 1234},
|
||||
?assertMatch({ok, _}, emqx:update_config([delayed], Conf1#{<<"enable">> := true})),
|
||||
?assert(is_hooks_exist()),
|
||||
?assertEqual(1234, emqx:get_config([delayed, max_delayed_messages])),
|
||||
?assertMatch({ok, _}, emqx:update_config([delayed], Conf1#{<<"enable">> := false})),
|
||||
?assertNot(is_hooks_exist()),
|
||||
?assertMatch({ok, _}, emqx:update_config([delayed], Conf)),
|
||||
ok.
|
||||
|
||||
is_hooks_exist() ->
|
||||
Hooks = emqx_hooks:lookup('message.publish'),
|
||||
false =/= lists:keyfind({emqx_delayed, on_message_publish, []}, 2, Hooks).
|
||||
|
|
Loading…
Reference in New Issue