Skip to content

Commit 1c9f3e8

Browse files
committed
Improve test speed
1 parent 4f62b5b commit 1c9f3e8

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

deps/rabbit/test/node_initial_run_SUITE.erl

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ verify_initial_run_disabled(Config) ->
8585
?assertNot(filelib:is_file(MarkerFile)),
8686

8787
% Restarting the node should work fine
88-
ok = rabbit_ct_broker_helpers:stop_node(Config, 0),
89-
ok = rabbit_ct_broker_helpers:start_node(Config, 0),
88+
ok = stop_app(Config),
89+
ok = start_app(Config),
9090
% Still no marker file
9191
?assertNot(filelib:is_file(MarkerFile)),
9292
ok.
@@ -100,28 +100,42 @@ verify_initial_run_enabled(Config) ->
100100

101101
% Restarting the node should be fine, as there is a marker file
102102
% and corresponding schema data (consistent state)
103-
ok = rabbit_ct_broker_helpers:stop_node(Config, 0),
104-
ok = rabbit_ct_broker_helpers:start_node(Config, 0),
103+
ok = stop_app(Config),
104+
ok = start_app(Config),
105105

106106
SchemaFile = schema_file(Config),
107107

108108
?assert(filelib:is_file(MarkerFile)),
109109

110110
% Stop the node and remove the present schema to simulate data loss
111-
ok = rabbit_ct_broker_helpers:stop_node(Config, 0),
111+
ok = stop_app(Config),
112112
file:delete(SchemaFile),
113113
% Node should fail to start because marker exists but schema is missing,
114114
% indicating potential data loss or corruption
115115
?assertMatch(
116-
{error, {skip, "Failed to initialize RabbitMQ"}},
117-
rabbit_ct_broker_helpers:start_node(Config, 0)
116+
{error, 69, _},
117+
start_app(Config)
118118
),
119119
ok.
120120

121121
%% -------------------------------------------------------------------
122122
%% Internal helpers
123123
%% -------------------------------------------------------------------
124124

125+
stop_app(Config) ->
126+
Node = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
127+
case rabbit_ct_broker_helpers:rabbitmqctl(Config, Node, ["stop_app"]) of
128+
{ok, _} -> ok;
129+
Error -> Error
130+
end.
131+
132+
start_app(Config) ->
133+
Node = rabbit_ct_broker_helpers:get_node_config(Config, 0, nodename),
134+
case rabbit_ct_broker_helpers:rabbitmqctl(Config, Node, ["start_app"]) of
135+
{ok, _} -> ok;
136+
Error -> Error
137+
end.
138+
125139
maybe_enable_verify_initial_run(Config, verify_initial_run_enabled) ->
126140
rabbit_ct_helpers:merge_app_env(
127141
Config, {rabbit, [{verify_initial_run, true}]}

0 commit comments

Comments
 (0)