Add test case for last change
This commit is contained in:
parent
e33414aca1
commit
a38d357847
|
@ -22,6 +22,12 @@
|
||||||
-export([restart_listener/1, restart_listener/3]).
|
-export([restart_listener/1, restart_listener/3]).
|
||||||
-export([stop_listener/1, stop_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()]}).
|
-type(listener() :: {esockd:proto(), esockd:listen_on(), [esockd:option()]}).
|
||||||
|
|
||||||
%% @doc Start all listeners.
|
%% @doc Start all listeners.
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
[start_stop_listeners,
|
[start_stop_listeners,
|
||||||
restart_listeners].
|
restart_listeners,
|
||||||
|
t_mqtt_path].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
NewConfig = generate_config(),
|
NewConfig = generate_config(),
|
||||||
|
@ -49,6 +50,11 @@ restart_listeners(_) ->
|
||||||
ok = emqx_listeners:restart(),
|
ok = emqx_listeners:restart(),
|
||||||
ok = emqx_listeners:stop().
|
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() ->
|
generate_config() ->
|
||||||
Schema = cuttlefish_schema:files([local_path(["priv", "emqx.schema"])]),
|
Schema = cuttlefish_schema:files([local_path(["priv", "emqx.schema"])]),
|
||||||
Conf = conf_parse:file([local_path(["etc", "gen.emqx.conf"])]),
|
Conf = conf_parse:file([local_path(["etc", "gen.emqx.conf"])]),
|
||||||
|
|
Loading…
Reference in New Issue