Skip to content

Commit 141f6bf

Browse files
Add a test case that imports definitions on boot
This is a follow-up to c503d57 which was a follow-up to 1257162.
1 parent c503d57 commit 141f6bf

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

test/definition_import_SUITE.erl

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525

2626
all() ->
2727
[
28-
{group, non_parallel_tests}
28+
{group, import_on_a_running_node},
29+
{group, import_on_a_booting_node}
2930
].
3031

3132
groups() ->
3233
[
33-
{non_parallel_tests, [], [
34+
{import_on_a_running_node, [], [
3435
%% Note: to make it easier to see which case failed,
3536
%% these are intentionally not folded into a single case.
3637
%% If generation becomes an alternative worth considering for these tests,
@@ -47,7 +48,10 @@ groups() ->
4748
import_case10,
4849
import_case11,
4950
import_case12
50-
]}
51+
]},
52+
{import_on_a_booting_node, [], [
53+
import_on_boot_case1
54+
]}
5155
].
5256

5357
%% -------------------------------------------------------------------
@@ -74,6 +78,20 @@ init_per_group(_, Config) ->
7478
end_per_group(_, Config) ->
7579
Config.
7680

81+
init_per_testcase(import_on_boot_case1 = Testcase, Config) ->
82+
CasePath = filename:join(?config(data_dir, Config), "case5.json"),
83+
Config1 = rabbit_ct_helpers:set_config(Config, [
84+
{rmq_nodename_suffix, Testcase},
85+
{rmq_nodes_count, 1}
86+
]),
87+
Config2 = rabbit_ct_helpers:merge_app_env(Config1,
88+
{rabbit, [
89+
{load_definitions, CasePath}
90+
]}),
91+
rabbit_ct_helpers:run_steps(Config2,
92+
rabbit_ct_broker_helpers:setup_steps() ++
93+
rabbit_ct_client_helpers:setup_steps()),
94+
rabbit_ct_helpers:testcase_started(Config, Testcase);
7795
init_per_testcase(Testcase, Config) ->
7896
rabbit_ct_helpers:testcase_started(Config, Testcase).
7997

@@ -108,6 +126,19 @@ import_case5(Config) ->
108126
import_case11(Config) -> import_file_case(Config, "case11").
109127
import_case12(Config) -> import_invalid_file_case(Config, "failing_case12").
110128

129+
import_on_boot_case1(Config) ->
130+
%% see case5.json
131+
VHost = <<"vhost2">>,
132+
%% verify that vhost2 eventually starts
133+
case rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_vhost, await_running_on_all_nodes, [VHost, 3000]) of
134+
ok -> ok;
135+
{error, timeout} -> ct:fail("virtual host ~p was not imported on boot", [VHost])
136+
end.
137+
138+
%%
139+
%% Implementation
140+
%%
141+
111142
import_file_case(Config, CaseName) ->
112143
CasePath = filename:join(?config(data_dir, Config), CaseName ++ ".json"),
113144
rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, run_import_case, [CasePath]),

0 commit comments

Comments
 (0)