summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <essen@ninenines.eu>2016-10-06 17:14:51 +0200
committerLoïc Hoguin <essen@ninenines.eu>2016-10-06 17:15:51 +0200
commit61250711fe23df9a4b3980fdc2f133eef7aa805e (patch)
treecd445ba37a91389165e4242dd8dfc841ca2e271c /test
parent34e264740a25cecc5da5b6ede1704717daadda4b (diff)
downloadrabbitmq-server-git-61250711fe23df9a4b3980fdc2f133eef7aa805e.tar.gz
Add a test for decrypt at start without passphrase
Diffstat (limited to 'test')
-rw-r--r--test/unit_SUITE.erl31
1 files changed, 28 insertions, 3 deletions
diff --git a/test/unit_SUITE.erl b/test/unit_SUITE.erl
index b6682f584a..56d02d6da7 100644
--- a/test/unit_SUITE.erl
+++ b/test/unit_SUITE.erl
@@ -70,20 +70,25 @@ groups() ->
]},
{sequential_tests, [], [
decrypt_start_app,
- decrypt_start_app_file
+ decrypt_start_app_file,
+ decrypt_start_app_undefined
]}
].
init_per_group(_, Config) -> Config.
end_per_group(_, Config) -> Config.
-init_per_testcase(decrypt_start_app, Config) ->
+init_per_testcase(TC, Config) when TC =:= decrypt_start_app;
+ TC =:= decrypt_start_app_file;
+ TC =:= decrypt_start_app_undefined ->
application:load(rabbit),
Config;
init_per_testcase(_, Config) ->
Config.
-end_per_testcase(TC, _Config) when TC =:= decrypt_start_app; TC =:= decrypt_start_app_file ->
+end_per_testcase(TC, _Config) when TC =:= decrypt_start_app;
+ TC =:= decrypt_start_app_file;
+ TC =:= decrypt_start_app_undefined ->
application:unload(rabbit),
application:unload(rabbit_shovel_test);
end_per_testcase(decrypt_config, _Config) ->
@@ -390,6 +395,26 @@ do_decrypt_start_app(Config, Passphrase) ->
"amqp://john:secret@host2.domain/my_vhost"] = Brokers,
ok.
+decrypt_start_app_undefined(Config) ->
+ %% Configure rabbit for decrypting configuration.
+ application:set_env(rabbit, decoder_config, [
+ {cipher, aes_cbc256},
+ {hash, sha512},
+ {iterations, 1000}
+ %% No passphrase option!
+ ]),
+ %% Add the path to our test application.
+ code:add_path(?config(data_dir, Config) ++ "/lib/rabbit_shovel_test/ebin"),
+ %% Attempt to start our test application.
+ %%
+ %% We expect a failure during decryption because the passphrase is missing.
+ try
+ rabbit:start_apps([rabbit_shovel_test])
+ catch
+ exit:{bad_configuration,decoder_config} -> ok;
+ _:_ -> exit(unexpected_exception)
+ end.
+
%% -------------------------------------------------------------------
%% pg_local.
%% -------------------------------------------------------------------