Skip to content

Commit 9b80b9c

Browse files
dumbbelllukebakken
authored andcommitted
Merge pull request #2325 from rabbitmq/revert-rabbitmq-server-2308-dead_queue_rejects
Revert "Remove dead_queue_rejects test flake" (cherry picked from commit 55d28f5)
1 parent 7de0c37 commit 9b80b9c

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

test/confirms_rejects_SUITE.erl

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ groups() ->
1818
[
1919
{parallel_tests, [parallel], [
2020
{overflow_reject_publish_dlx, [parallel], OverflowTests},
21-
{overflow_reject_publish, [parallel], OverflowTests}
21+
{overflow_reject_publish, [parallel], OverflowTests},
22+
dead_queue_rejects
2223
]}
2324
].
2425

@@ -62,7 +63,8 @@ init_per_testcase(policy_resets_to_default = Testcase, Config) ->
6263
rabbit_ct_helpers:testcase_started(
6364
rabbit_ct_helpers:set_config(Config, [{conn, Conn}]), Testcase);
6465
init_per_testcase(Testcase, Config)
65-
when Testcase == confirms_rejects_conflict ->
66+
when Testcase == confirms_rejects_conflict;
67+
Testcase == dead_queue_rejects ->
6668
Conn = rabbit_ct_client_helpers:open_unmanaged_connection(Config),
6769
Conn1 = rabbit_ct_client_helpers:open_unmanaged_connection(Config),
6870

@@ -87,6 +89,10 @@ end_per_testcase(confirms_rejects_conflict = Testcase, Config) ->
8789
XOverflow = ?config(overflow, Config),
8890
QueueName = <<"confirms_rejects_conflict", "_", XOverflow/binary>>,
8991
amqp_channel:call(Ch, #'queue.delete'{queue = QueueName}),
92+
end_per_testcase0(Testcase, Config);
93+
end_per_testcase(dead_queue_rejects = Testcase, Config) ->
94+
{_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
95+
amqp_channel:call(Ch, #'queue.delete'{queue = <<"dead_queue_rejects">>}),
9096
end_per_testcase0(Testcase, Config).
9197

9298
end_per_testcase0(Testcase, Config) ->
@@ -102,6 +108,37 @@ end_per_testcase0(Testcase, Config) ->
102108

103109
rabbit_ct_helpers:testcase_finished(Config, Testcase).
104110

111+
dead_queue_rejects(Config) ->
112+
Conn = ?config(conn, Config),
113+
{ok, Ch} = amqp_connection:open_channel(Conn),
114+
QueueName = <<"dead_queue_rejects">>,
115+
amqp_channel:call(Ch, #'confirm.select'{}),
116+
amqp_channel:register_confirm_handler(Ch, self()),
117+
118+
amqp_channel:call(Ch, #'queue.declare'{queue = QueueName,
119+
durable = true}),
120+
121+
amqp_channel:call(Ch, #'basic.publish'{routing_key = QueueName},
122+
#amqp_msg{payload = <<"HI">>}),
123+
124+
receive
125+
{'basic.ack',_,_} -> ok
126+
after 10000 ->
127+
error(timeout_waiting_for_initial_ack)
128+
end,
129+
130+
kill_the_queue(QueueName, Config),
131+
132+
amqp_channel:cast(Ch, #'basic.publish'{routing_key = QueueName},
133+
#amqp_msg{payload = <<"HI">>}),
134+
135+
receive
136+
{'basic.ack',_,_} -> error(expecting_nack_got_ack);
137+
{'basic.nack',_,_,_} -> ok
138+
after 10000 ->
139+
error(timeout_waiting_for_nack)
140+
end.
141+
105142
confirms_rejects_conflict(Config) ->
106143
Conn = ?config(conn, Config),
107144
Conn1 = ?config(conn1, Config),
@@ -284,7 +321,7 @@ clean_acks_mailbox() ->
284321
end.
285322

286323
kill_the_queue(QueueName, Config) ->
287-
rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, kill_the_queue, [QueueName]).
324+
ok = rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, kill_the_queue, [QueueName]).
288325

289326
kill_the_queue(QueueName) ->
290327
[begin
@@ -300,8 +337,3 @@ kill_the_queue(QueueName) ->
300337
true -> kill_the_queue(QueueName);
301338
false -> ok
302339
end.
303-
304-
305-
306-
307-

0 commit comments

Comments
 (0)