From 30c14e6f35ac32f6e57e047674aaf6aa1cd9b290 Mon Sep 17 00:00:00 2001 From: Karl Nilsson Date: Mon, 24 Jun 2024 15:14:39 +0100 Subject: [PATCH] speed up product_info_SUITE By running all tests in a single node rather than starting a new one for each test. --- .../peer_discovery_classic_config_SUITE.erl | 1 + deps/rabbit/test/product_info_SUITE.erl | 64 ++++++++----------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/deps/rabbit/test/peer_discovery_classic_config_SUITE.erl b/deps/rabbit/test/peer_discovery_classic_config_SUITE.erl index f621a689f1..b8c7597eeb 100644 --- a/deps/rabbit/test/peer_discovery_classic_config_SUITE.erl +++ b/deps/rabbit/test/peer_discovery_classic_config_SUITE.erl @@ -15,6 +15,7 @@ cluster_members_online/2 ]). +-compile(nowarn_export_all). -compile(export_all). all() -> diff --git a/deps/rabbit/test/product_info_SUITE.erl b/deps/rabbit/test/product_info_SUITE.erl index 3e25fcd2b5..b99caa7e65 100644 --- a/deps/rabbit/test/product_info_SUITE.erl +++ b/deps/rabbit/test/product_info_SUITE.erl @@ -55,53 +55,43 @@ init_per_suite(Config) -> end. end_per_suite(Config) -> - rabbit_ct_helpers:run_teardown_steps(Config). - -init_per_group(_, Config) -> Config. -end_per_group(_, Config) -> - Config. - -init_per_testcase(Testcase, Config) -> - rabbit_ct_helpers:testcase_started(Config, Testcase), +init_per_group(Group, Config0) -> ClusterSize = 1, - TestNumber = rabbit_ct_helpers:testcase_number(Config, ?MODULE, Testcase), + PrivDir = ?config(priv_dir, Config0), + MotdFile = filename:join(PrivDir, "motd.txt"), + ok = file:write_file(MotdFile, <<"My MOTD\n">>), Config1 = rabbit_ct_helpers:set_config( - Config, + Config0, [ - {rmq_nodename_suffix, Testcase}, - {tcp_ports_base, {skip_n_nodes, TestNumber * ClusterSize}} + {rmq_nodename_suffix, Group}, + {tcp_ports_base, {skip_n_nodes, ClusterSize}}, + {motd_file, MotdFile} ]), - Config2 = case Testcase of - override_product_name_in_conf -> - rabbit_ct_helpers:merge_app_env( - Config1, - {rabbit, [{product_name, "MyProduct"}]}); - override_product_version_in_conf -> - rabbit_ct_helpers:merge_app_env( - Config1, - {rabbit, [{product_version, "MyVersion"}]}); - set_motd_in_conf -> - PrivDir = ?config(priv_dir, Config), - MotdFile = filename:join(PrivDir, "motd.txt"), - ok = file:write_file(MotdFile, <<"My MOTD\n">>), - C2 = rabbit_ct_helpers:set_config( - Config1, - {motd_file, MotdFile}), - rabbit_ct_helpers:merge_app_env( - C2, - {rabbit, [{motd_file, MotdFile}]}) - end, - rabbit_ct_helpers:run_steps(Config2, + + Config = rabbit_ct_helpers:merge_app_env( + Config1, + {rabbit, [ + {product_name, "MyProduct"}, + {product_version, "MyVersion"}, + {motd_file, MotdFile}]}), + rabbit_ct_helpers:run_steps(Config, rabbit_ct_broker_helpers:setup_steps() ++ rabbit_ct_client_helpers:setup_steps()). +end_per_group(_, Config) -> + rabbit_ct_helpers:run_steps(Config, + rabbit_ct_client_helpers:teardown_steps() ++ + rabbit_ct_broker_helpers:teardown_steps()). + +init_per_testcase(Testcase, Config) -> + rabbit_ct_helpers:testcase_started(Config, Testcase), + Config. + end_per_testcase(Testcase, Config) -> - Config1 = rabbit_ct_helpers:run_steps(Config, - rabbit_ct_client_helpers:teardown_steps() ++ - rabbit_ct_broker_helpers:teardown_steps()), - rabbit_ct_helpers:testcase_finished(Config1, Testcase). + rabbit_ct_helpers:testcase_finished(Config, Testcase), + Config. %% ------------------------------------------------------------------- %% Testcases.