fix(listeners): update the testcases for listeners

This commit is contained in:
Shawn 2021-08-31 14:21:53 +08:00
parent 0af39e88a4
commit 7e53469bb8
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,7 @@
%% API functions %% API functions
-export([ start_link/0 -export([ start_link/0
, stop/0
, add_handler/2 , add_handler/2
, remove_handler/1 , remove_handler/1
, update_config/3 , update_config/3
@ -68,6 +69,9 @@
start_link() -> start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, {}, []). gen_server:start_link({local, ?MODULE}, ?MODULE, {}, []).
stop() ->
gen_server:stop(?MODULE).
-spec update_config(module(), emqx_config:config_key_path(), emqx_config:update_args()) -> -spec update_config(module(), emqx_config:config_key_path(), emqx_config:update_args()) ->
{ok, emqx_config:update_result()} | {error, emqx_config:update_error()}. {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
update_config(SchemaModule, ConfKeyPath, UpdateArgs) -> update_config(SchemaModule, ConfKeyPath, UpdateArgs) ->

View File

@ -37,6 +37,14 @@ end_per_suite(_Config) ->
application:stop(esockd), application:stop(esockd),
application:stop(cowboy). application:stop(cowboy).
init_per_testcase(_, Config) ->
{ok, _} = emqx_config_handler:start_link(),
Config.
end_per_testcase(_, _Config) ->
_ = emqx_config_handler:stop(),
ok.
t_start_stop_listeners(_) -> t_start_stop_listeners(_) ->
ok = emqx_listeners:start(), ok = emqx_listeners:start(),
?assertException(error, _, emqx_listeners:start_listener({ws,{"127.0.0.1", 8083}, []})), ?assertException(error, _, emqx_listeners:start_listener({ws,{"127.0.0.1", 8083}, []})),