test(flaky): avoid inter-suite flakiness

This commit is contained in:
Thales Macedo Garitezi 2022-12-01 13:23:05 -03:00
parent fffce9316c
commit 82be9d878d
1 changed files with 10 additions and 54 deletions

View File

@ -64,34 +64,10 @@ wait_until_kafka_is_up(Attempts) ->
end. end.
init_per_suite(Config) -> init_per_suite(Config) ->
%% Need to unload emqx_authz. See emqx_machine_SUITE:init_per_suite for ok = emqx_common_test_helpers:start_apps([emqx_conf]),
%% more info. ok = emqx_connector_test_helpers:start_apps([emqx_resource, emqx_bridge, emqx_rule_engine]),
application:unload(emqx_authz), {ok, _} = application:ensure_all_started(emqx_connector),
%% some configs in emqx_conf app are mandatory emqx_mgmt_api_test_util:init_suite(),
emqx_common_test_helpers:render_and_load_app_config(emqx_conf),
emqx_common_test_helpers:start_apps(
[emqx_conf, emqx_rule_engine, emqx_bridge, emqx_management, emqx_dashboard],
fun set_special_configs/1
),
application:set_env(emqx_machine, applications, [
emqx_prometheus,
emqx_modules,
emqx_dashboard,
emqx_gateway,
emqx_statsd,
emqx_resource,
emqx_rule_engine,
emqx_bridge,
emqx_ee_bridge,
emqx_plugin_libs,
emqx_management,
emqx_retainer,
emqx_exhook,
emqx_authn,
emqx_authz,
emqx_plugin
]),
{ok, _} = application:ensure_all_started(emqx_machine),
wait_until_kafka_is_up(), wait_until_kafka_is_up(),
%% Wait until bridges API is up %% Wait until bridges API is up
(fun WaitUntilRestApiUp() -> (fun WaitUntilRestApiUp() ->
@ -106,32 +82,12 @@ init_per_suite(Config) ->
end)(), end)(),
Config. Config.
end_per_suite(Config) -> end_per_suite(_Config) ->
emqx_common_test_helpers:stop_apps([ emqx_mgmt_api_test_util:end_suite(),
emqx_prometheus, ok = emqx_common_test_helpers:stop_apps([emqx_conf]),
emqx_modules, ok = emqx_connector_test_helpers:stop_apps([emqx_bridge, emqx_resource, emqx_rule_engine]),
emqx_dashboard, _ = application:stop(emqx_connector),
emqx_gateway, ok.
emqx_statsd,
emqx_resource,
emqx_rule_engine,
emqx_bridge,
emqx_ee_bridge,
emqx_plugin_libs,
emqx_management,
emqx_retainer,
emqx_exhook,
emqx_authn,
emqx_authz,
emqx_plugin,
emqx_conf,
emqx_bridge,
emqx_management,
emqx_dashboard,
emqx_machine
]),
mria:stop(),
Config.
set_special_configs(emqx_management) -> set_special_configs(emqx_management) ->
Listeners = #{http => #{port => 8081}}, Listeners = #{http => #{port => 8081}},