Skip to content

Commit f4dcb15

Browse files
committed
Fix mixed version test failure
Prior to this commit, test case ``` make -C deps/rabbit distclean-ct ct-dead_lettering SECONDARY_UMBRELLA=workspace/rabbitmq-server-tmp t=[tests,classic_queue,at_most_once]:dead_letter_headers_should_not_be_appended_for_republish RABBITMQ_FEATURE_FLAGS=quorum_queue,implicit_default_bindings,virtual_host_metadata,maintenance_mode_status,user_limits,feature_flags_v2,stream_queue,classic_queue_type_delivery_support,classic_mirrored_queue_version,stream_single_active_consumer,direct_exchange_routing_v2,listener_records_in_ets,tracking_records_in_ets,message_containers,message_containers_deaths_v2,quorum_queue_non_voters ``` failed because of a wrong expectation. The 3.13 node interprets the x-death header, which means there are two death history entries after the message expires from the source queue on the 4.0 node.
1 parent 3cbcaae commit f4dcb15

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

deps/rabbit/test/dead_lettering_SUITE.erl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,24 +1359,33 @@ dead_letter_headers_should_not_be_appended_for_republish(Config) ->
13591359
amqp_channel:call(Ch0, #'basic.get'{queue = DlxName}),
13601360
{array, [{table, Death1}]} = rabbit_misc:table_lookup(Headers1, <<"x-death">>),
13611361
?assertEqual({longstr, <<"rejected">>}, rabbit_misc:table_lookup(Death1, <<"reason">>)),
1362-
13631362
amqp_channel:cast(Ch0, #'basic.ack'{delivery_tag = DTag1}),
1364-
13651363
wait_for_messages(Config, [[DlxName, <<"0">>, <<"0">>, <<"0">>]]),
13661364

13671365
#'queue.delete_ok'{} = amqp_channel:call(Ch0, #'queue.delete'{queue = QName}),
13681366
DeadLetterArgs1 = DeadLetterArgs ++ [{<<"x-message-ttl">>, long, 1}],
13691367
#'queue.declare_ok'{} = amqp_channel:call(Ch0, #'queue.declare'{queue = QName, arguments = DeadLetterArgs1 ++ Args, durable = Durable}),
13701368

1371-
publish(Ch1, QName, [P], Headers1),
1372-
1369+
publish(Ch0, QName, [P], Headers1),
13731370
wait_for_messages(Config, [[DlxName, <<"1">>, <<"1">>, <<"0">>]]),
1374-
{#'basic.get_ok'{}, #amqp_msg{payload = P,
1375-
props = #'P_basic'{headers = Headers2}}} =
1371+
{#'basic.get_ok'{delivery_tag = DTag2},
1372+
#amqp_msg{payload = P,
1373+
props = #'P_basic'{headers = Headers2}}} =
13761374
amqp_channel:call(Ch0, #'basic.get'{queue = DlxName}),
1377-
13781375
{array, [{table, Death2}]} = rabbit_misc:table_lookup(Headers2, <<"x-death">>),
13791376
?assertEqual({longstr, <<"expired">>}, rabbit_misc:table_lookup(Death2, <<"reason">>)),
1377+
amqp_channel:cast(Ch0, #'basic.ack'{delivery_tag = DTag2}),
1378+
wait_for_messages(Config, [[DlxName, <<"0">>, <<"0">>, <<"0">>]]),
1379+
1380+
%% In 4.0/3.13 mixed version testing, the 3.13 node will interpret
1381+
%% the x-death header of the message we publish next.
1382+
publish(Ch1, QName, [P], Headers1),
1383+
%% Our expectation is no crash when this message is dead lettered on the 4.0 node, see
1384+
%% https://github.com/rabbitmq/rabbitmq-server/issues/12933
1385+
wait_for_messages(Config, [[DlxName, <<"1">>, <<"1">>, <<"0">>]]),
1386+
?assertMatch({#'basic.get_ok'{}, #amqp_msg{payload = P}},
1387+
amqp_channel:call(Ch0, #'basic.get'{queue = DlxName})),
1388+
13801389
ok = rabbit_ct_client_helpers:close_connection(Conn0),
13811390
ok = rabbit_ct_client_helpers:close_connection(Conn1).
13821391

0 commit comments

Comments
 (0)