summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2020-04-27 17:53:04 +0000
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2020-05-12 15:24:57 +0200
commitc2eaa5a164c94df00b64dec0e7c432c7545decca (patch)
tree40e475c13f340b6068bc325a253ccace9314e494 /test
parenta58b9cfe7f89843d9d80bbf9961d984a94b7eeee (diff)
downloadrabbitmq-server-git-c2eaa5a164c94df00b64dec0e7c432c7545decca.tar.gz
Revert "Remove mixed_dead_alive_queues_reject test flake"
This reverts commit d8771acee402446071b945c76b9dc737e572b992.
Diffstat (limited to 'test')
-rw-r--r--test/confirms_rejects_SUITE.erl97
1 files changed, 95 insertions, 2 deletions
diff --git a/test/confirms_rejects_SUITE.erl b/test/confirms_rejects_SUITE.erl
index 56d95df878..6aaf688180 100644
--- a/test/confirms_rejects_SUITE.erl
+++ b/test/confirms_rejects_SUITE.erl
@@ -18,7 +18,9 @@ groups() ->
[
{parallel_tests, [parallel], [
{overflow_reject_publish_dlx, [parallel], OverflowTests},
- {overflow_reject_publish, [parallel], OverflowTests}
+ {overflow_reject_publish, [parallel], OverflowTests},
+ dead_queue_rejects,
+ mixed_dead_alive_queues_reject
]}
].
@@ -62,7 +64,9 @@ init_per_testcase(policy_resets_to_default = Testcase, Config) ->
rabbit_ct_helpers:testcase_started(
rabbit_ct_helpers:set_config(Config, [{conn, Conn}]), Testcase);
init_per_testcase(Testcase, Config)
- when Testcase == confirms_rejects_conflict ->
+ when Testcase == confirms_rejects_conflict;
+ Testcase == dead_queue_rejects;
+ Testcase == mixed_dead_alive_queues_reject ->
Conn = rabbit_ct_client_helpers:open_unmanaged_connection(Config),
Conn1 = rabbit_ct_client_helpers:open_unmanaged_connection(Config),
@@ -87,6 +91,15 @@ end_per_testcase(confirms_rejects_conflict = Testcase, Config) ->
XOverflow = ?config(overflow, Config),
QueueName = <<"confirms_rejects_conflict", "_", XOverflow/binary>>,
amqp_channel:call(Ch, #'queue.delete'{queue = QueueName}),
+ end_per_testcase0(Testcase, Config);
+end_per_testcase(dead_queue_rejects = Testcase, Config) ->
+ {_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
+ amqp_channel:call(Ch, #'queue.delete'{queue = <<"dead_queue_rejects">>});
+end_per_testcase(mixed_dead_alive_queues_reject = Testcase, Config) ->
+ {_, Ch} = rabbit_ct_client_helpers:open_connection_and_channel(Config, 0),
+ amqp_channel:call(Ch, #'queue.delete'{queue = <<"mixed_dead_alive_queues_reject_dead">>}),
+ amqp_channel:call(Ch, #'queue.delete'{queue = <<"mixed_dead_alive_queues_reject_alive">>}),
+ amqp_channel:call(Ch, #'exchange.delete'{exchange = <<"mixed_dead_alive_queues_reject">>}),
end_per_testcase0(Testcase, Config).
end_per_testcase0(Testcase, Config) ->
@@ -102,6 +115,86 @@ end_per_testcase0(Testcase, Config) ->
rabbit_ct_helpers:testcase_finished(Config, Testcase).
+dead_queue_rejects(Config) ->
+ Conn = ?config(conn, Config),
+ {ok, Ch} = amqp_connection:open_channel(Conn),
+ QueueName = <<"dead_queue_rejects">>,
+ amqp_channel:call(Ch, #'confirm.select'{}),
+ amqp_channel:register_confirm_handler(Ch, self()),
+
+ amqp_channel:call(Ch, #'queue.declare'{queue = QueueName,
+ durable = true}),
+
+ amqp_channel:call(Ch, #'basic.publish'{routing_key = QueueName},
+ #amqp_msg{payload = <<"HI">>}),
+
+ receive
+ {'basic.ack',_,_} -> ok
+ after 10000 ->
+ error(timeout_waiting_for_initial_ack)
+ end,
+
+ kill_the_queue(QueueName, Config),
+
+ amqp_channel:cast(Ch, #'basic.publish'{routing_key = QueueName},
+ #amqp_msg{payload = <<"HI">>}),
+
+ receive
+ {'basic.ack',_,_} -> error(expecting_nack_got_ack);
+ {'basic.nack',_,_,_} -> ok
+ after 10000 ->
+ error(timeout_waiting_for_nack)
+
+mixed_dead_alive_queues_reject(Config) ->
+ Conn = ?config(conn, Config),
+ {ok, Ch} = amqp_connection:open_channel(Conn),
+ QueueNameDead = <<"mixed_dead_alive_queues_reject_dead">>,
+ QueueNameAlive = <<"mixed_dead_alive_queues_reject_alive">>,
+ ExchangeName = <<"mixed_dead_alive_queues_reject">>,
+
+ amqp_channel:call(Ch, #'confirm.select'{}),
+ amqp_channel:register_confirm_handler(Ch, self()),
+
+ amqp_channel:call(Ch, #'queue.declare'{queue = QueueNameDead,
+ durable = true}),
+ amqp_channel:call(Ch, #'queue.declare'{queue = QueueNameAlive,
+ durable = true}),
+
+ amqp_channel:call(Ch, #'exchange.declare'{exchange = ExchangeName,
+ durable = true}),
+
+ amqp_channel:call(Ch, #'queue.bind'{exchange = ExchangeName,
+ queue = QueueNameAlive,
+ routing_key = <<"route">>}),
+
+ amqp_channel:call(Ch, #'queue.bind'{exchange = ExchangeName,
+ queue = QueueNameDead,
+ routing_key = <<"route">>}),
+
+ amqp_channel:call(Ch, #'basic.publish'{exchange = ExchangeName,
+ routing_key = <<"route">>},
+ #amqp_msg{payload = <<"HI">>}),
+
+ receive
+ {'basic.ack',_,_} -> ok;
+ {'basic.nack',_,_,_} -> error(expecting_ack_got_nack)
+ after 50000 ->
+ error({timeout_waiting_for_initial_ack, process_info(self(), messages)})
+ end,
+
+ kill_the_queue(QueueNameDead, Config),
+
+ amqp_channel:call(Ch, #'basic.publish'{exchange = ExchangeName,
+ routing_key = <<"route">>},
+ #amqp_msg{payload = <<"HI">>}),
+
+ receive
+ {'basic.nack',_,_,_} -> ok;
+ {'basic.ack',_,_} -> error(expecting_nack_got_ack)
+ after 50000 ->
+ error({timeout_waiting_for_nack, process_info(self(), messages)})
+ end.
+
confirms_rejects_conflict(Config) ->
Conn = ?config(conn, Config),
Conn1 = ?config(conn1, Config),