Fix test flake
Prior to this commit, test ``` ERL_AFLAGS="+S 2" make -C deps/rabbit ct-amqp_client t=cluster_size_3:detach_requeues_two_connections_quorum_queue ``` failed rarely locally, and more often in CI. An instance of a failed test in CI is https://github.com/rabbitmq/rabbitmq-server/actions/runs/10298099899/job/28502687451?pr=11945 The test failed with: ``` === === Reason: {assertEqual,[{module,amqp_client_SUITE}, {line,2800}, {expression,"amqp10_msg : body ( Msg1 )"}, {expected,[<<"1">>]}, {value,[<<"2">>]}]} in function amqp_client_SUITE:detach_requeues_two_connections/2 (amqp_client_SUITE.erl, line 2800) ``` because it could happen that Receiver1's credit top up to the quorum queue is applied before Receiver0's credit top up such that Receiver1 gets enqueued to the ServiceQueue before Receiver0.
This commit is contained in:
parent
194d4ba2f5
commit
aeedad7b51
|
@ -2767,6 +2767,7 @@ detach_requeues_two_connections(QType, Config) ->
|
|||
{ok, LinkPair} = rabbitmq_amqp_client:attach_management_link_pair_sync(Session1, <<"my link pair">>),
|
||||
QProps = #{arguments => #{<<"x-queue-type">> => {utf8, QType}}},
|
||||
{ok, #{type := QType}} = rabbitmq_amqp_client:declare_queue(LinkPair, QName, QProps),
|
||||
flush(link_pair_attached),
|
||||
|
||||
%% Attach 1 sender and 2 receivers.
|
||||
{ok, Sender} = amqp10_client:attach_sender_link(Session0, <<"sender">>, Address, settled),
|
||||
|
@ -2778,13 +2779,16 @@ detach_requeues_two_connections(QType, Config) ->
|
|||
end,
|
||||
ok = gen_statem:cast(Session0, {flow_session, #'v1_0.flow'{incoming_window = {uint, 1}}}),
|
||||
ok = amqp10_client:flow_link_credit(Receiver0, 50, never),
|
||||
%% Wait for credit being applied to the queue.
|
||||
timer:sleep(10),
|
||||
|
||||
{ok, Receiver1} = amqp10_client:attach_receiver_link(Session1, <<"receiver 1">>, Address, unsettled),
|
||||
receive {amqp10_event, {link, Receiver1, attached}} -> ok
|
||||
after 5000 -> ct:fail({missing_event, ?LINE})
|
||||
end,
|
||||
ok = amqp10_client:flow_link_credit(Receiver1, 50, never),
|
||||
flush(attached),
|
||||
ok = amqp10_client:flow_link_credit(Receiver1, 40, never),
|
||||
%% Wait for credit being applied to the queue.
|
||||
timer:sleep(10),
|
||||
|
||||
NumMsgs = 6,
|
||||
[begin
|
||||
|
|
Loading…
Reference in New Issue