summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniil Fedotov <dfedotov@pivotal.io>2017-06-06 15:27:37 +0100
committerDaniil Fedotov <dfedotov@pivotal.io>2017-06-06 15:27:37 +0100
commit6ad1cd16f0352a75446fcf94eb2fce2d50d69889 (patch)
tree98e923e5d366f821d51c0126049b138a12be543b /test
parentf3a2b1ff1722220f5800a974fdd8fdc5faadebce (diff)
downloadrabbitmq-server-git-6ad1cd16f0352a75446fcf94eb2fce2d50d69889.tar.gz
OTP-20 compatibility workaround for queue directory names.
OTP-20 has different binary format for atoms (since OTP-14337) So term_to_binary generates different value. testm_to_binary_compat now have a function to generate a binary identical to pre-20 versions.
Diffstat (limited to 'test')
-rw-r--r--test/backing_queue_SUITE.erl2
-rw-r--r--test/term_to_binary_compat_prop_SUITE.erl62
2 files changed, 63 insertions, 1 deletions
diff --git a/test/backing_queue_SUITE.erl b/test/backing_queue_SUITE.erl
index ccef4ec7c7..441e1127a7 100644
--- a/test/backing_queue_SUITE.erl
+++ b/test/backing_queue_SUITE.erl
@@ -1253,7 +1253,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/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