test(mgmt): better isolate testsuite running environments

This commit is contained in:
Andrew Mayorov 2024-05-23 17:53:13 +02:00
parent ba6382adae
commit d47bf8076a
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
4 changed files with 33 additions and 13 deletions

View File

@ -29,11 +29,18 @@ all() ->
emqx_common_test_helpers:all(?MODULE). emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) -> init_per_suite(Config) ->
emqx_mgmt_api_test_util:init_suite(), Apps = emqx_cth_suite:start(
Config. [
emqx,
emqx_management,
emqx_mgmt_api_test_util:emqx_dashboard()
],
#{work_dir => emqx_cth_suite:work_dir(Config)}
),
[{apps, Apps} | Config].
end_per_suite(_) -> end_per_suite(Config) ->
emqx_mgmt_api_test_util:end_suite(). ok = emqx_cth_suite:stop(?config(apps, Config)).
init_per_testcase(Case, Config) -> init_per_testcase(Case, Config) ->
?MODULE:Case({init, Config}). ?MODULE:Case({init, Config}).

View File

@ -33,7 +33,6 @@ init_per_suite(Config) ->
], ],
#{work_dir => emqx_cth_suite:work_dir(Config)} #{work_dir => emqx_cth_suite:work_dir(Config)}
), ),
{ok, _Api} = emqx_common_test_http:create_default_app(),
[{apps, Apps} | Config]. [{apps, Apps} | Config].
end_per_suite(Config) -> end_per_suite(Config) ->

View File

@ -51,11 +51,18 @@ groups() ->
]. ].
init_per_suite(Config) -> init_per_suite(Config) ->
emqx_mgmt_api_test_util:init_suite(), Apps = emqx_cth_suite:start(
Config. [
emqx,
emqx_management,
emqx_mgmt_api_test_util:emqx_dashboard()
],
#{work_dir => emqx_cth_suite:work_dir(Config)}
),
[{apps, Apps} | Config].
end_per_suite(_) -> end_per_suite(Config) ->
emqx_mgmt_api_test_util:end_suite(). ok = emqx_cth_suite:stop(?config(apps, Config)).
init_per_group(api_status_endpoint, Config) -> init_per_group(api_status_endpoint, Config) ->
[{get_status_path, ["api", "v5", "status"]} | Config]; [{get_status_path, ["api", "v5", "status"]} | Config];

View File

@ -25,12 +25,19 @@ all() ->
emqx_common_test_helpers:all(?MODULE). emqx_common_test_helpers:all(?MODULE).
init_per_suite(Config) -> init_per_suite(Config) ->
emqx_mgmt_api_test_util:init_suite([emqx_conf, emqx_management]), Apps = emqx_cth_suite:start(
[
emqx_conf,
emqx_management,
emqx_mgmt_api_test_util:emqx_dashboard()
],
#{work_dir => emqx_cth_suite:work_dir(Config)}
),
ok = emqx_mgmt_cli:load(), ok = emqx_mgmt_cli:load(),
Config. [{apps, Apps} | Config].
end_per_suite(_) -> end_per_suite(Config) ->
emqx_mgmt_api_test_util:end_suite([emqx_management, emqx_conf]). ok = emqx_cth_suite:stop(?config(apps, Config)).
init_per_testcase(t_autocluster_leave = TC, Config) -> init_per_testcase(t_autocluster_leave = TC, Config) ->
[Core1, Core2, Repl1, Repl2] = [Core1, Core2, Repl1, Repl2] =