summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/backing_queue_SUITE.erl2
-rw-r--r--test/cluster_SUITE.erl2
-rw-r--r--test/cluster_formation_locking_SUITE.erl80
-rw-r--r--test/clustering_management_SUITE.erl8
-rw-r--r--test/term_to_binary_compat_prop_SUITE.erl62
-rw-r--r--test/unit_SUITE.erl6
-rw-r--r--test/unit_inbroker_parallel_SUITE.erl2
7 files changed, 152 insertions, 10 deletions
diff --git a/test/backing_queue_SUITE.erl b/test/backing_queue_SUITE.erl
index 3ff215f497..60f86e0542 100644
--- a/test/backing_queue_SUITE.erl
+++ b/test/backing_queue_SUITE.erl
@@ -1256,7 +1256,7 @@ make_publish_delivered(IsPersistent, PayloadFun, PropFun, N) ->
PropFun(N, #message_properties{size = 10})}.
queue_name(Config, Name) ->
- Name1 = rabbit_ct_helpers:config_to_testcase_name(Config, Name),
+ Name1 = iolist_to_binary(rabbit_ct_helpers:config_to_testcase_name(Config, Name)),
queue_name(Name1).
queue_name(Name) ->
diff --git a/test/cluster_SUITE.erl b/test/cluster_SUITE.erl
index bc442ecba7..3dba65ae1f 100644
--- a/test/cluster_SUITE.erl
+++ b/test/cluster_SUITE.erl
@@ -355,7 +355,7 @@ test_spawn_remote() ->
end.
queue_name(Config, Name) ->
- Name1 = rabbit_ct_helpers:config_to_testcase_name(Config, Name),
+ Name1 = iolist_to_binary(rabbit_ct_helpers:config_to_testcase_name(Config, Name)),
queue_name(Name1).
queue_name(Name) ->
diff --git a/test/cluster_formation_locking_SUITE.erl b/test/cluster_formation_locking_SUITE.erl
new file mode 100644
index 0000000000..25b2df308c
--- /dev/null
+++ b/test/cluster_formation_locking_SUITE.erl
@@ -0,0 +1,80 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License
+%% at http://www.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and
+%% limitations under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developer of the Original Code is GoPivotal, Inc.
+%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved.
+%%
+-module(cluster_formation_locking_SUITE).
+
+-include_lib("common_test/include/ct.hrl").
+-include_lib("eunit/include/eunit.hrl").
+
+-compile(export_all).
+
+all() ->
+ [
+ {group, non_parallel_tests}
+ ].
+
+groups() ->
+ [
+ {non_parallel_tests, [], [
+ init_with_lock_exits_after_errors,
+ init_with_lock_ignore_after_errors,
+ init_with_lock_not_supported,
+ init_with_lock_supported
+ ]}
+ ].
+
+init_per_testcase(Testcase, Config) when Testcase == init_with_lock_exits_after_errors;
+ Testcase == init_with_lock_not_supported;
+ Testcase == init_with_lock_supported ->
+ application:set_env(rabbit, cluster_formation,
+ [{peer_discover_backend, peer_discover_classic_config},
+ {lock_acquisition_failure_mode, fail}]),
+ ok = meck:new(rabbit_peer_discovery_classic_config, [passthrough]),
+ Config;
+init_per_testcase(init_with_lock_ignore_after_errors, Config) ->
+ application:set_env(rabbit, cluster_formation,
+ [{peer_discover_backend, peer_discover_classic_config},
+ {lock_acquisition_failure_mode, ignore}]),
+ ok = meck:new(rabbit_peer_discovery_classic_config, [passthrough]),
+ Config.
+
+end_per_testcase(_, _) ->
+ meck:unload(),
+ application:unset_env(rabbit, cluster_formation).
+
+init_with_lock_exits_after_errors(_Config) ->
+ meck:expect(rabbit_peer_discovery_classic_config, lock, fun(_) -> {error, "test error"} end),
+ ?assertExit(cannot_acquire_startup_lock, rabbit_mnesia:init_with_lock(2, 10, fun() -> ok end)),
+ ?assert(meck:validate(rabbit_peer_discovery_classic_config)),
+ passed.
+
+init_with_lock_ignore_after_errors(_Config) ->
+ meck:expect(rabbit_peer_discovery_classic_config, lock, fun(_) -> {error, "test error"} end),
+ ?assertEqual(ok, rabbit_mnesia:init_with_lock(2, 10, fun() -> ok end)),
+ ?assert(meck:validate(rabbit_peer_discovery_classic_config)),
+ passed.
+
+init_with_lock_not_supported(_Config) ->
+ meck:expect(rabbit_peer_discovery_classic_config, lock, fun(_) -> not_supported end),
+ ?assertEqual(ok, rabbit_mnesia:init_with_lock(2, 10, fun() -> ok end)),
+ ?assert(meck:validate(rabbit_peer_discovery_classic_config)),
+ passed.
+
+init_with_lock_supported(_Config) ->
+ meck:expect(rabbit_peer_discovery_classic_config, lock, fun(_) -> {ok, data} end),
+ meck:expect(rabbit_peer_discovery_classic_config, unlock, fun(data) -> ok end),
+ ?assertEqual(ok, rabbit_mnesia:init_with_lock(2, 10, fun() -> ok end)),
+ ?assert(meck:validate(rabbit_peer_discovery_classic_config)),
+ passed.
diff --git a/test/clustering_management_SUITE.erl b/test/clustering_management_SUITE.erl
index b0a93ad208..51c0928ba5 100644
--- a/test/clustering_management_SUITE.erl
+++ b/test/clustering_management_SUITE.erl
@@ -135,7 +135,8 @@ join_and_part_cluster(Config) ->
%% Allow clustering with already clustered node
ok = stop_app(Rabbit),
- {ok, already_member} = join_cluster(Rabbit, Hare),
+ {ok, <<"The node is already a member of this cluster">>} =
+ join_cluster(Rabbit, Hare),
ok = start_app(Rabbit),
stop_reset_start(Rabbit),
@@ -388,10 +389,9 @@ force_boot(Config) ->
change_cluster_node_type(Config) ->
[Rabbit, Hare, _Bunny] = cluster_members(Config),
- %% Trying to change the ram node when not clustered should always fail
+ %% Trying to change the node to the ram type when not clustered should always fail
ok = stop_app(Rabbit),
assert_failure(fun () -> change_cluster_node_type(Rabbit, ram) end),
- assert_failure(fun () -> change_cluster_node_type(Rabbit, disc) end),
ok = start_app(Rabbit),
ok = stop_app(Rabbit),
@@ -643,7 +643,7 @@ wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts, Timeout) ->
Pid = pid_from_file(PidFile),
case rabbit_misc:is_os_process_alive(Pid) of
true -> ok;
- false ->
+ false ->
ct:sleep(Timeout),
wait_for_pid_file_to_contain_running_process_pid(PidFile, Attempts - 1, Timeout)
end.
diff --git a/test/term_to_binary_compat_prop_SUITE.erl b/test/term_to_binary_compat_prop_SUITE.erl
new file mode 100644
index 0000000000..d09b23c9ea
--- /dev/null
+++ b/test/term_to_binary_compat_prop_SUITE.erl
@@ -0,0 +1,62 @@
+%% The contents of this file are subject to the Mozilla Public License
+%% Version 1.1 (the "License"); you may not use this file except in
+%% compliance with the License. You may obtain a copy of the License
+%% at http://www.mozilla.org/MPL/
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and
+%% limitations under the License.
+%%
+%% The Original Code is RabbitMQ.
+%%
+%% The Initial Developer of the Original Code is GoPivotal, Inc.
+%% Copyright (c) 2017 Pivotal Software, Inc. All rights reserved.
+%%
+
+
+-module(term_to_binary_compat_prop_SUITE).
+
+-compile(export_all).
+
+-include("rabbit.hrl").
+-include_lib("common_test/include/ct.hrl").
+-include_lib("proper/include/proper.hrl").
+
+all() ->
+ %% The test should run on OTP < 20 (erts < 9)
+ case erts_gt_8() of
+ true ->
+ [];
+ false ->
+ [queue_name_to_binary]
+ end.
+
+erts_gt_8() ->
+ Vsn = erlang:system_info(version),
+ [Maj|_] = string:tokens(Vsn, "."),
+ list_to_integer(Maj) > 8.
+
+init_per_suite(Config) ->
+ rabbit_ct_helpers:log_environment(),
+ rabbit_ct_helpers:run_setup_steps(Config).
+
+end_per_suite(Config) ->
+ rabbit_ct_helpers:run_teardown_steps(Config).
+
+init_per_testcase(Testcase, Config) ->
+ rabbit_ct_helpers:testcase_started(Config, Testcase).
+
+queue_name_to_binary(Config) ->
+ Fun = fun () -> prop_queue_name_to_binary(Config) end,
+ rabbit_ct_proper_helpers:run_proper(Fun, [], 10000).
+
+
+prop_queue_name_to_binary(_Config) ->
+ ?FORALL({Vhost, QName}, {binary(), binary()},
+ begin
+ Resource = rabbit_misc:r(Vhost, queue, QName),
+ Legacy = term_to_binary_compat:queue_name_to_binary(Resource),
+ Current = term_to_binary(Resource),
+ Current =:= Legacy
+ end). \ No newline at end of file
diff --git a/test/unit_SUITE.erl b/test/unit_SUITE.erl
index f3fec06cb4..3e92158595 100644
--- a/test/unit_SUITE.erl
+++ b/test/unit_SUITE.erl
@@ -332,7 +332,7 @@ do_decrypt_start_app(Config, Passphrase) ->
%%
%% We expect a failure *after* the decrypting has been done.
try
- rabbit:start_apps([rabbit_shovel_test])
+ rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
catch _:_ ->
ok
end,
@@ -359,7 +359,7 @@ decrypt_start_app_undefined(Config) ->
%%
%% We expect a failure during decryption because the passphrase is missing.
try
- rabbit:start_apps([rabbit_shovel_test])
+ rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
catch
exit:{bad_configuration, config_entry_decoder} -> ok;
_:_ -> exit(unexpected_exception)
@@ -379,7 +379,7 @@ decrypt_start_app_wrong_passphrase(Config) ->
%%
%% We expect a failure during decryption because the passphrase is wrong.
try
- rabbit:start_apps([rabbit_shovel_test])
+ rabbit:start_apps([rabbit_shovel_test], #{rabbit => temporary})
catch
exit:{decryption_error,_,_} -> ok;
_:_ -> exit(unexpected_exception)
diff --git a/test/unit_inbroker_parallel_SUITE.erl b/test/unit_inbroker_parallel_SUITE.erl
index f9cfd58eaa..9c274ab525 100644
--- a/test/unit_inbroker_parallel_SUITE.erl
+++ b/test/unit_inbroker_parallel_SUITE.erl
@@ -146,7 +146,7 @@ on_disk_stop(Pid) ->
end.
queue_name(Config, Name) ->
- Name1 = rabbit_ct_helpers:config_to_testcase_name(Config, Name),
+ Name1 = iolist_to_binary(rabbit_ct_helpers:config_to_testcase_name(Config, Name)),
queue_name(Name1).
queue_name(Name) ->