chore(mix): fix app dependencies and reboot apps (emqx_conf)

While declaring `emqx_conf` as an application dependency of
`emqx_resource` worked for releases, it messed up the startup
relationship during tests.  Since only removing `emqx_conf` from the
`applications` key in `emqx_resource` breaks the list of apps that
need to be rebooted on config changes (since `emqx_conf` is not on any
apps dependencies list, it was not being added to the final
topologically sorted list), we now always add it as a vertex to ensure
its presence there.  This (apparently) makes the rebar3 release, the
mix release and test runs behave normally.
This commit is contained in:
Thales Macedo Garitezi 2021-12-23 08:48:11 -03:00
parent 238895a301
commit 11c169501e
No known key found for this signature in database
GPG Key ID: DD279F8152A9B6DD
3 changed files with 8 additions and 3 deletions

View File

@ -135,6 +135,12 @@ add_app(G, App, undefined) ->
?SLOG(debug, #{msg => "app_is_not_loaded", app => App}), ?SLOG(debug, #{msg => "app_is_not_loaded", app => App}),
%% not loaded %% not loaded
add_app(G, App, []); add_app(G, App, []);
% We ALWAYS want to add `emqx_conf', even if no other app declare a
% dependency on it. Otherwise, emqx may fail to load the config
% schemas, especially in the test profile.
add_app(G, App = emqx_conf, []) ->
digraph:add_vertex(G, App),
ok;
add_app(_G, _App, []) -> add_app(_G, _App, []) ->
ok; ok;
add_app(G, App, [Dep | Deps]) -> add_app(G, App, [Dep | Deps]) ->

View File

@ -43,7 +43,7 @@ init_per_suite(Config) ->
%% %%
application:unload(emqx_authz), application:unload(emqx_authz),
emqx_common_test_helpers:start_apps([]), emqx_common_test_helpers:start_apps([emqx_conf]),
Config. Config.
end_per_suite(_Config) -> end_per_suite(_Config) ->

View File

@ -9,8 +9,7 @@
stdlib, stdlib,
gproc, gproc,
jsx, jsx,
emqx, emqx
emqx_conf
]}, ]},
{env,[]}, {env,[]},
{modules, []}, {modules, []},