Skip to content

Commit ed00c84

Browse files
dumbbellgerhard
authored andcommitted
Fix term_to_binary_compat tests in R16B03
For realz this time R16B03 defaults term_to_binary version to 0, this test would always fail Signed-off-by: Gerhard Lazu <[email protected]>
1 parent c253b42 commit ed00c84

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

src/term_to_binary_compat.erl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@
2222

2323
term_to_binary_1(Term) ->
2424
term_to_binary(Term, [{minor_version, 1}]).
25-

test/term_to_binary_compat_prop_SUITE.erl

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
all() ->
2929
[
30-
pre_3_6_11_works,
30+
ensure_term_to_binary_defaults_to_version_1,
3131
term_to_binary_latin_atom,
3232
queue_name_to_binary
3333
].
@@ -47,19 +47,32 @@ end_per_suite(Config) ->
4747
init_per_testcase(Testcase, Config) ->
4848
rabbit_ct_helpers:testcase_started(Config, Testcase).
4949

50-
%% If this test fails - the erlang version is not supported in
51-
%% RabbitMQ-3.6.10 and earlier.
52-
pre_3_6_11_works(Config) ->
53-
Property = fun () -> prop_pre_3_6_11_works(Config) end,
54-
rabbit_ct_proper_helpers:run_proper(Property, [],
55-
?ITERATIONS_TO_RUN_UNTIL_CONFIDENT).
56-
57-
prop_pre_3_6_11_works(_Config) ->
50+
%% R16B03 defaults term_to_binary version to 0, this test would always fail
51+
ensure_term_to_binary_defaults_to_version_1(Config) ->
52+
CurrentERTS = erlang:system_info(version),
53+
MinimumTestedERTS = "6.0",
54+
case rabbit_misc:version_compare(CurrentERTS, MinimumTestedERTS, gte) of
55+
true ->
56+
Property = fun () ->
57+
prop_ensure_term_to_binary_defaults_to_version_1(Config)
58+
end,
59+
rabbit_ct_proper_helpers:run_proper(
60+
Property, [],
61+
?ITERATIONS_TO_RUN_UNTIL_CONFIDENT);
62+
false ->
63+
ct:pal(
64+
?LOW_IMPORTANCE,
65+
"This test require ERTS ~p or above, running on ~p~n"
66+
"Skipping test...",
67+
[MinimumTestedERTS, CurrentERTS])
68+
end.
69+
70+
prop_ensure_term_to_binary_defaults_to_version_1(_Config) ->
5871
?FORALL(Term, any(),
5972
begin
6073
Current = term_to_binary(Term),
6174
Compat = term_to_binary_compat:term_to_binary_1(Term),
62-
binary_to_term(Current) =:= binary_to_term(Compat)
75+
Current =:= Compat
6376
end).
6477

6578
term_to_binary_latin_atom(Config) ->

0 commit comments

Comments
 (0)