Skip to content

Commit fb82e4b

Browse files
author
Daniil Fedotov
committed
APi to start_apps with different modes. Required by tests to not stop the common_test node
1 parent d6fedd2 commit fb82e4b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/rabbit.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
is_running/1, environment/0, rotate_logs/0, force_event_refresh/1,
2424
start_fhc/0]).
2525
-export([start/2, stop/1, prep_stop/1]).
26-
-export([start_apps/1, stop_apps/1]).
26+
-export([start_apps/1, start_apps/2, stop_apps/1]).
2727
-export([log_locations/0, config_files/0, decrypt_config/2]). %% for testing and mgmt-agent
2828

2929
-ifdef(TEST).
@@ -266,6 +266,8 @@
266266
-spec boot_delegate() -> 'ok'.
267267
-spec recover() -> 'ok'.
268268
-spec start_apps([app_name()]) -> 'ok'.
269+
-spec start_apps([app_name()],
270+
#{app_name() => permanent|transient|temporary}) -> 'ok'.
269271
-spec stop_apps([app_name()]) -> 'ok'.
270272

271273
%%----------------------------------------------------------------------------
@@ -506,6 +508,9 @@ stop_and_halt() ->
506508
ok.
507509

508510
start_apps(Apps) ->
511+
start_apps(Apps, #{}).
512+
513+
start_apps(Apps, AppModes) ->
509514
app_utils:load_applications(Apps),
510515

511516
ConfigEntryDecoder = case application:get_env(rabbit, config_entry_decoder) of
@@ -545,7 +550,8 @@ start_apps(Apps) ->
545550
true -> ok %% will run during start of rabbit app
546551
end,
547552
ok = app_utils:start_applications(OrderedApps,
548-
handle_app_error(could_not_start)).
553+
handle_app_error(could_not_start),
554+
AppModes).
549555

550556
%% This function retrieves the correct IoDevice for requesting
551557
%% input. The problem with using the default IoDevice is that

test/unit_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ do_decrypt_start_app(Config, Passphrase) ->
332332
%%
333333
%% We expect a failure *after* the decrypting has been done.
334334
try
335-
rabbit:start_apps([rabbit_shovel_test])
335+
rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
336336
catch _:_ ->
337337
ok
338338
end,
@@ -359,7 +359,7 @@ decrypt_start_app_undefined(Config) ->
359359
%%
360360
%% We expect a failure during decryption because the passphrase is missing.
361361
try
362-
rabbit:start_apps([rabbit_shovel_test])
362+
rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
363363
catch
364364
exit:{bad_configuration, config_entry_decoder} -> ok;
365365
_:_ -> exit(unexpected_exception)
@@ -379,7 +379,7 @@ decrypt_start_app_wrong_passphrase(Config) ->
379379
%%
380380
%% We expect a failure during decryption because the passphrase is wrong.
381381
try
382-
rabbit:start_apps([rabbit_shovel_test])
382+
rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
383383
catch
384384
exit:{decryption_error,_,_} -> ok;
385385
_:_ -> exit(unexpected_exception)

0 commit comments

Comments
 (0)