Add test case for last change

This commit is contained in:
周子博 2018-09-14 10:40:16 +08:00 committed by Feng Lee
parent 6f536eaac4
commit 5465b015be
2 changed files with 13 additions and 1 deletions

View File

@ -22,6 +22,12 @@
-export([restart_listener/1, restart_listener/3]).
-export([stop_listener/1, stop_listener/3]).
-ifdef(TEST).
-export([mqtt_path/1]).
-endif.
-type(listener() :: {esockd:proto(), esockd:listen_on(), [esockd:option()]}).
%% @doc Start all listeners.

View File

@ -26,7 +26,8 @@
all() ->
[start_stop_listeners,
restart_listeners].
restart_listeners,
t_mqtt_path].
init_per_suite(Config) ->
NewConfig = generate_config(),
@ -49,6 +50,11 @@ restart_listeners(_) ->
ok = emqx_listeners:restart(),
ok = emqx_listeners:stop().
t_mqtt_path(_) ->
?assertEqual("/test", emqx_listeners:mqtt_path([{mqtt_path, "/test"}])),
?assertEqual("/", emqx_listeners:mqtt_path([{mqtt_path, "/"}])),
?assertEqual("/mqtt", emqx_listeners:mqtt_path([{mqtt_path, "test"}])).
generate_config() ->
Schema = cuttlefish_schema:files([local_path(["priv", "emqx.schema"])]),
Conf = conf_parse:file([local_path(["etc", "gen.emqx.conf"])]),