fix(ft): set default ft config in tests

This commit is contained in:
Ilya Averyanov 2023-04-05 21:10:32 +03:00
parent 918bdcae7d
commit 4a144044b7
3 changed files with 13 additions and 28 deletions

View File

@ -26,30 +26,12 @@ all() -> emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) -> init_per_suite(Config) ->
_ = emqx_config:save_schema_mod_and_names(emqx_ft_schema), _ = emqx_config:save_schema_mod_and_names(emqx_ft_schema),
ok = emqx_common_test_helpers:start_apps([emqx_conf, emqx_ft], fun set_special_config/1), ok = emqx_common_test_helpers:start_apps(
[emqx_conf, emqx_ft], emqx_ft_test_helpers:env_handler(Config)
),
{ok, _} = emqx:update_config([rpc, port_discovery], manual), {ok, _} = emqx:update_config([rpc, port_discovery], manual),
Config. Config.
set_special_config(emqx_ft) ->
emqx_config:put(
[file_transfer],
#{
storage => #{
type => local,
segments => #{
gc => #{
interval => 60000
}
},
exporter => #{
type => local
}
}
}
);
set_special_config(_) ->
ok.
end_per_suite(_Config) -> end_per_suite(_Config) ->
ok = emqx_common_test_helpers:stop_apps([emqx_ft, emqx_conf]), ok = emqx_common_test_helpers:stop_apps([emqx_ft, emqx_conf]),
ok. ok.

View File

@ -24,7 +24,7 @@
all() -> emqx_common_test_helpers:all(?MODULE). all() -> emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) -> init_per_suite(Config) ->
ok = emqx_common_test_helpers:start_apps([emqx_ft]), ok = emqx_common_test_helpers:start_apps([emqx_ft], emqx_ft_test_helpers:env_handler(Config)),
Config. Config.
end_per_suite(_Config) -> end_per_suite(_Config) ->

View File

@ -28,12 +28,7 @@ start_additional_node(Config, Name) ->
{apps, [emqx_ft]}, {apps, [emqx_ft]},
{join_to, node()}, {join_to, node()},
{configure_gen_rpc, true}, {configure_gen_rpc, true},
{env_handler, fun {env_handler, env_handler(Config)}
(emqx_ft) ->
load_config(#{storage => local_storage(Config)});
(_) ->
ok
end}
] ]
). ).
@ -43,6 +38,14 @@ stop_additional_node(Node) ->
ok = emqx_common_test_helpers:stop_slave(Node), ok = emqx_common_test_helpers:stop_slave(Node),
ok. ok.
env_handler(Config) ->
fun
(emqx_ft) ->
load_config(#{storage => local_storage(Config)});
(_) ->
ok
end.
local_storage(Config) -> local_storage(Config) ->
#{ #{
type => local, type => local,