test(migration): fix code scope

This commit is contained in:
zhouzb 2021-11-15 18:14:51 +08:00
parent fce93c5a17
commit 2f279b3607
1 changed files with 7 additions and 4 deletions

View File

@ -20,11 +20,16 @@
-compile(nowarn_export_all).
-include_lib("eunit/include/eunit.hrl").
-ifdef(EMQX_ENTERPRISE).
-include_lib("emqx_modules/include/emqx_modules.hrl").
-endif.
all() ->
emqx_ct:all(?MODULE).
-ifdef(EMQX_ENTERPRISE).
init_per_suite(Config) ->
application:load(emqx_modules_spec),
emqx_ct_helpers:start_apps([emqx_management, emqx_modules]),
@ -35,8 +40,6 @@ end_per_suite(_Config) ->
application:unload(emqx_modules_spec),
ok.
-ifdef(EMQX_ENTERPRISE).
t_import_4_2(Config) ->
?assertMatch(ok, import("e4.2.8.json", Config)),
timer:sleep(100),
@ -55,11 +58,11 @@ t_import_4_3(Config) ->
?assertMatch(#module{config = #{<<"srv_record">> := _}}, MongoAuthNModule),
delete_modules().
-endif.
import(File, Config) ->
Filename = filename:join(proplists:get_value(data_dir, Config), File),
emqx_mgmt_data_backup:import(Filename, "{}").
delete_modules() ->
[emqx_modules_registry:remove_module(Mod) || Mod <- emqx_modules_registry:get_modules()].
-endif.