fix(test): make mria fall back to use mnesia db_backend when running test

This commit is contained in:
Shawn 2022-04-20 12:04:29 +08:00
parent 3ce969fd79
commit 56044085c8
1 changed files with 10 additions and 1 deletions

View File

@ -150,7 +150,7 @@ start_apps(Apps, Handler) when is_function(Handler) ->
%% Load all application code to beam vm first %% Load all application code to beam vm first
%% Because, minirest, ekka etc.. application will scan these modules %% Because, minirest, ekka etc.. application will scan these modules
lists:foreach(fun load/1, [emqx | Apps]), lists:foreach(fun load/1, [emqx | Apps]),
ekka:start(), ok = start_ekka(),
ok = emqx_ratelimiter_SUITE:base_conf(), ok = emqx_ratelimiter_SUITE:base_conf(),
lists:foreach(fun(App) -> start_app(App, Handler) end, [emqx | Apps]). lists:foreach(fun(App) -> start_app(App, Handler) end, [emqx | Apps]).
@ -484,3 +484,12 @@ is_tcp_server_available(Host, Port, Timeout) ->
{error, _} -> {error, _} ->
false false
end. end.
start_ekka() ->
try mnesia_hook:module_info() of
_ -> ekka:start()
catch _:_ ->
%% Falling back to using Mnesia DB backend.
application:set_env(mria, db_backend, mnesia),
ekka:start()
end.