fix: allow listener not_found before restart
This commit is contained in:
parent
38ac10d3e2
commit
d3d8b3a01f
|
@ -175,9 +175,10 @@ restart_listener(Type, ListenerName, Conf) ->
|
||||||
restart_listener(Type, ListenerName, Conf, Conf).
|
restart_listener(Type, ListenerName, Conf, Conf).
|
||||||
|
|
||||||
restart_listener(Type, ListenerName, OldConf, NewConf) ->
|
restart_listener(Type, ListenerName, OldConf, NewConf) ->
|
||||||
case stop_listener(Type, ListenerName, OldConf) of
|
case do_stop_listener(Type, ListenerName, OldConf) of
|
||||||
ok -> start_listener(Type, ListenerName, NewConf);
|
ok -> start_listener(Type, ListenerName, NewConf);
|
||||||
Error -> Error
|
{error, not_found} -> start_listener(Type, ListenerName, NewConf);
|
||||||
|
{error, Reason} -> {error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @doc Stop all listeners.
|
%% @doc Stop all listeners.
|
||||||
|
|
|
@ -120,6 +120,7 @@ all(Suite) ->
|
||||||
string:substr(atom_to_list(F), 1, 2) == "t_"
|
string:substr(atom_to_list(F), 1, 2) == "t_"
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
%% set emqx app boot modules
|
||||||
-spec(boot_modules(all|list(atom())) -> ok).
|
-spec(boot_modules(all|list(atom())) -> ok).
|
||||||
boot_modules(Mods) ->
|
boot_modules(Mods) ->
|
||||||
application:set_env(emqx, boot_modules, Mods).
|
application:set_env(emqx, boot_modules, Mods).
|
||||||
|
@ -162,8 +163,7 @@ app_schema(App) ->
|
||||||
mustache_vars(App) ->
|
mustache_vars(App) ->
|
||||||
[{platform_data_dir, app_path(App, "data")},
|
[{platform_data_dir, app_path(App, "data")},
|
||||||
{platform_etc_dir, app_path(App, "etc")},
|
{platform_etc_dir, app_path(App, "etc")},
|
||||||
{platform_log_dir, app_path(App, "log")},
|
{platform_log_dir, app_path(App, "log")}
|
||||||
{platform_plugins_dir, app_path(App, "plugins")}
|
|
||||||
].
|
].
|
||||||
|
|
||||||
start_app(App, Schema, ConfigFile, SpecAppConfig) ->
|
start_app(App, Schema, ConfigFile, SpecAppConfig) ->
|
||||||
|
|
|
@ -132,8 +132,7 @@ render_config_file() ->
|
||||||
mustache_vars() ->
|
mustache_vars() ->
|
||||||
[{platform_data_dir, local_path(["data"])},
|
[{platform_data_dir, local_path(["data"])},
|
||||||
{platform_etc_dir, local_path(["etc"])},
|
{platform_etc_dir, local_path(["etc"])},
|
||||||
{platform_log_dir, local_path(["log"])},
|
{platform_log_dir, local_path(["log"])}
|
||||||
{platform_plugins_dir, local_path(["plugins"])}
|
|
||||||
].
|
].
|
||||||
|
|
||||||
generate_config() ->
|
generate_config() ->
|
||||||
|
@ -144,10 +143,6 @@ generate_config() ->
|
||||||
set_app_env({App, Lists}) ->
|
set_app_env({App, Lists}) ->
|
||||||
lists:foreach(fun({authz_file, _Var}) ->
|
lists:foreach(fun({authz_file, _Var}) ->
|
||||||
application:set_env(App, authz_file, local_path(["etc", "authz.conf"]));
|
application:set_env(App, authz_file, local_path(["etc", "authz.conf"]));
|
||||||
({plugins_loaded_file, _Var}) ->
|
|
||||||
application:set_env(App,
|
|
||||||
plugins_loaded_file,
|
|
||||||
local_path(["test", "emqx_SUITE_data","loaded_plugins"]));
|
|
||||||
({Par, Var}) ->
|
({Par, Var}) ->
|
||||||
application:set_env(App, Par, Var)
|
application:set_env(App, Par, Var)
|
||||||
end, Lists).
|
end, Lists).
|
||||||
|
|
|
@ -160,9 +160,6 @@ init_per_group(gc_tests, Config) ->
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
set_special_confs(emqx) ->
|
|
||||||
Path = emqx_common_test_helpers:deps_path(emqx, "test/emqx_SUITE_data/loaded_plugins"),
|
|
||||||
application:set_env(emqx, plugins_loaded_file, Path);
|
|
||||||
set_special_confs(_) ->
|
set_special_confs(_) ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@ plugins {
|
||||||
}
|
}
|
||||||
external {
|
external {
|
||||||
}
|
}
|
||||||
install_dir = "plugins"
|
install_dir = "{{ platform_plugins_dir }}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,9 @@ init_per_suite(Config) ->
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_common_test_helpers:stop_apps([]).
|
emqx_common_test_helpers:boot_modules(all),
|
||||||
|
emqx_common_test_helpers:stop_apps([]),
|
||||||
|
emqx_config:erase(plugins).
|
||||||
|
|
||||||
t_load(_) ->
|
t_load(_) ->
|
||||||
?assertEqual(ok, emqx_plugins:load()),
|
?assertEqual(ok, emqx_plugins:load()),
|
||||||
|
@ -57,7 +59,7 @@ t_load(_) ->
|
||||||
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_mini_plugin)),
|
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_mini_plugin)),
|
||||||
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_hocon_plugin)),
|
?assertEqual({error, not_started}, emqx_plugins:unload(emqx_hocon_plugin)),
|
||||||
|
|
||||||
emqx_config:put([plugins, install_dir], undefined).
|
emqx_config:erase(plugins).
|
||||||
|
|
||||||
t_load_ext_plugin(_) ->
|
t_load_ext_plugin(_) ->
|
||||||
?assertError({plugin_app_file_not_found, _},
|
?assertError({plugin_app_file_not_found, _},
|
||||||
|
|
|
@ -55,6 +55,7 @@ init_per_suite(Config) ->
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
emqx_common_test_helpers:stop_apps([emqx_retainer]).
|
emqx_common_test_helpers:stop_apps([emqx_retainer]).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Test Cases
|
%% Test Cases
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
|
@ -257,7 +257,7 @@ overlay_vars_pkg(pkg) ->
|
||||||
, {platform_etc_dir, "/etc/emqx"}
|
, {platform_etc_dir, "/etc/emqx"}
|
||||||
, {platform_lib_dir, ""}
|
, {platform_lib_dir, ""}
|
||||||
, {platform_log_dir, "/var/log/emqx"}
|
, {platform_log_dir, "/var/log/emqx"}
|
||||||
, {platform_plugins_dir, "/var/lib/enqx/plugins"}
|
, {platform_plugins_dir, "/var/lib/emqx/plugins"}
|
||||||
, {runner_root_dir, "/usr/lib/emqx"}
|
, {runner_root_dir, "/usr/lib/emqx"}
|
||||||
, {runner_bin_dir, "/usr/bin"}
|
, {runner_bin_dir, "/usr/bin"}
|
||||||
, {runner_etc_dir, "/etc/emqx"}
|
, {runner_etc_dir, "/etc/emqx"}
|
||||||
|
|
Loading…
Reference in New Issue