test: EMQX_ETC_DIR for test is app's etc dir

This commit is contained in:
Zaiming (Stone) Shi 2023-04-27 16:23:32 +02:00
parent e0dc5645ab
commit a1551213c8
1 changed files with 9 additions and 1 deletions

View File

@ -3181,5 +3181,13 @@ resolve_env(Name0) ->
true ->
{ok, Value};
false ->
error
special_env(Name)
end.
-ifdef(TEST).
%% when running tests, we need to mock the env variables
special_env("EMQX_ETC_DIR") ->
{ok, filename:join([code:lib_dir(emqx), etc])}.
-else.
special_env(_Name) -> error.
-endif.