Skip to content
This repository was archived by the owner on Jul 9, 2024. It is now read-only.

Commit b26e20c

Browse files
Use only a subset of queues in routing tests
1 parent 60e6904 commit b26e20c

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

test/rabbit_exchange_type_consistent_hash_SUITE.erl

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,29 @@ end_per_testcase(Testcase, Config) ->
8383
%% Test cases
8484
%% -------------------------------------------------------------------
8585

86-
-define(Qs, [<<"q0">>, <<"q1">>, <<"q2">>, <<"q3">>, <<"q4">>, <<"q5">>, <<"q6">>,
87-
<<"e-q0">>, <<"e-q1">>, <<"e-q2">>, <<"e-q3">>, <<"e-q4">>, <<"e-q5">>, <<"e-q6">>,
88-
<<"d-q0">>, <<"d-q1">>, <<"d-q2">>, <<"d-q3">>, <<"d-q4">>, <<"d-q5">>, <<"d-q6">>]).
86+
-define(AllQs, [<<"q0">>, <<"q1">>, <<"q2">>, <<"q3">>, <<"q4">>, <<"q5">>, <<"q6">>,
87+
<<"e-q0">>, <<"e-q1">>, <<"e-q2">>, <<"e-q3">>, <<"e-q4">>, <<"e-q5">>, <<"e-q6">>,
88+
<<"d-q0">>, <<"d-q1">>, <<"d-q2">>, <<"d-q3">>, <<"d-q4">>, <<"d-q5">>, <<"d-q6">>]).
89+
-define(RoutingTestQs, [<<"q0">>, <<"q1">>, <<"q2">>, <<"q3">>]).
90+
8991
%% N.B. lowering this value below 100K increases the probability
9092
%% of failing the Chi squared test in some environments
9193
-define(DEFAULT_SAMPLE_COUNT, 150000).
9294

9395
routing_key_hashing_test(Config) ->
94-
ok = test_with_rk(Config, ?Qs).
96+
ok = test_with_rk(Config, ?RoutingTestQs).
9597

9698
custom_header_hashing_test(Config) ->
97-
ok = test_with_header(Config, ?Qs).
99+
ok = test_with_header(Config, ?RoutingTestQs).
98100

99101
message_id_hashing_test(Config) ->
100-
ok = test_with_message_id(Config, ?Qs).
102+
ok = test_with_message_id(Config, ?RoutingTestQs).
101103

102104
correlation_id_hashing_test(Config) ->
103-
ok = test_with_correlation_id(Config, ?Qs).
105+
ok = test_with_correlation_id(Config, ?RoutingTestQs).
104106

105107
timestamp_hashing_test(Config) ->
106-
ok = test_with_timestamp(Config, ?Qs).
108+
ok = test_with_timestamp(Config, ?RoutingTestQs).
107109

108110
other_routing_test(Config) ->
109111
ok = test_binding_with_negative_routing_key(Config),
@@ -193,8 +195,8 @@ rnd() ->
193195
rnd_int() ->
194196
rand:uniform(10000000).
195197

196-
test0(Config, MakeMethod, MakeMsg, DeclareArgs, [Q1, Q2, Q3, Q4] = Queues) ->
197-
test0(Config, MakeMethod, MakeMsg, DeclareArgs, [Q1, Q2, Q3, Q4] = Queues, ?DEFAULT_SAMPLE_COUNT).
198+
test0(Config, MakeMethod, MakeMsg, DeclareArgs, Queues) ->
199+
test0(Config, MakeMethod, MakeMsg, DeclareArgs, Queues, ?DEFAULT_SAMPLE_COUNT).
198200

199201
test0(Config, MakeMethod, MakeMsg, DeclareArgs, [Q1, Q2, Q3, Q4] = Queues, IterationCount) ->
200202
Chan = rabbit_ct_client_helpers:open_channel(Config, 0),
@@ -343,9 +345,6 @@ test_hash_ring_updates_when_multiple_queues_are_deleted(Config) ->
343345
type = <<"x-consistent-hash">>},
344346
#'exchange.declare_ok'{} = amqp_channel:call(Chan, Declare),
345347

346-
ct:pal("all hash ring rows before declaration: ~p",
347-
[hash_ring_rows(Config)]),
348-
349348
Queues = [<<"d-q1">>, <<"d-q2">>, <<"d-q3">>],
350349
[#'queue.declare_ok'{} =
351350
amqp_channel:call(Chan, #'queue.declare'{
@@ -356,8 +355,6 @@ test_hash_ring_updates_when_multiple_queues_are_deleted(Config) ->
356355
routing_key = <<"3">>})
357356
|| Q <- Queues],
358357

359-
ct:pal("all hash ring rows: ~p", [hash_ring_rows(Config)]),
360-
361358
?assertEqual(9, count_buckets_of_exchange(Config, X)),
362359
assert_ring_consistency(Config, X),
363360

@@ -394,11 +391,15 @@ test_hash_ring_updates_when_exclusive_queues_are_deleted_due_to_connection_closu
394391
routing_key = <<"3">>})
395392
|| Q <- Queues],
396393

394+
ct:pal("all hash ring rows: ~p", [hash_ring_rows(Config)]),
395+
397396
?assertEqual(18, count_buckets_of_exchange(Config, X)),
398397
assert_ring_consistency(Config, X),
399398
ok = amqp_connection:close(Conn),
400399
timer:sleep(500),
401400

401+
ct:pal("all hash ring rows after connection closure: ~p", [hash_ring_rows(Config)]),
402+
402403
?assertEqual(0, count_buckets_of_exchange(Config, X)),
403404
clean_up_test_topology(Config, X, []),
404405
ok.
@@ -504,7 +505,7 @@ count_all_hash_ring_buckets(Config) ->
504505
lists:foldl(fun(#chx_hash_ring{bucket_map = M}, Acc) -> Acc + maps:size(M) end, 0, Rows).
505506

506507
clean_up_test_topology(Config) ->
507-
clean_up_test_topology(Config, none, ?Qs).
508+
clean_up_test_topology(Config, none, ?AllQs).
508509

509510
clean_up_test_topology(Config, none, Qs) ->
510511
Ch = rabbit_ct_client_helpers:open_channel(Config, 0),

0 commit comments

Comments
 (0)