Skip to content

Commit

Permalink
Fix test flake
Browse files Browse the repository at this point in the history
As described in #12413 (comment)
test case queue_topology flaked in CI with the following error:
```
rabbitmq_amqp_client > management_SUITE > cluster_size_3 > queue_topology
    #1. {error,{test_case_failed,{824,
                                  <<"rmq-ct-cluster_size_3-1-21000@localhost">>}}}
```

This flake could not be reproduced locally (neither with Mnesia nor with Khepri).
  • Loading branch information
ansd authored and michaelklishin committed Oct 25, 2024
1 parent 9dc9f97 commit ad7f0ab
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions deps/rabbitmq_amqp_client/test/management_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -810,25 +810,30 @@ queue_topology(Config) ->
ok = rabbit_ct_broker_helpers:stop_node(Config, 0),

Init2 = {_, LinkPair2} = init(Config, 2),
{ok, QQInfo2} = rabbitmq_amqp_client:get_queue(LinkPair2, QQName),
{ok, SQInfo2} = rabbitmq_amqp_client:get_queue(LinkPair2, SQName),

case maps:get(leader, QQInfo2) of
N1 -> ok;
N2 -> ok;
Other0 -> ct:fail({?LINE, Other0})
end,
case maps:get(leader, SQInfo2) of
N1 -> ok;
N2 -> ok;
Other1 -> ct:fail({?LINE, Other1})
end,

%% Replicas should include both online and offline replicas.
{ok, QQReplicas2} = maps:find(replicas, QQInfo2),
?assertEqual(Nodes, lists:usort(QQReplicas2)),
{ok, SQReplicas2} = maps:find(replicas, SQInfo2),
?assertEqual(Nodes, lists:usort(SQReplicas2)),
eventually(
?_assert(
begin
{ok, QQInfo2} = rabbitmq_amqp_client:get_queue(LinkPair2, QQName),
{ok, SQInfo2} = rabbitmq_amqp_client:get_queue(LinkPair2, SQName),

{ok, QQReplicas2} = maps:find(replicas, QQInfo2),
{ok, SQReplicas2} = maps:find(replicas, SQInfo2),
QQReplicas = lists:usort(QQReplicas2),
SQReplicas = lists:usort(SQReplicas2),
QQLeader = maps:get(leader, QQInfo2),
SQLeader = maps:get(leader, SQInfo2),
ct:pal("quorum queue replicas: ~p~n"
"quorum queue leader: ~s~n"
"stream replicas: ~p~n"
"stream leader: ~s",
[QQReplicas, QQLeader, SQReplicas, SQLeader]),
%% Replicas should always include both online and offline replicas.
QQReplicas =:= Nodes andalso
SQReplicas =:= Nodes andalso
(QQLeader =:= N1 orelse QQLeader =:= N2) andalso
(SQLeader =:= N1 orelse SQLeader =:= N2)
end
), 1000, 5),

ok = rabbit_ct_broker_helpers:start_node(Config, 0),
{ok, _} = rabbitmq_amqp_client:delete_queue(LinkPair2, CQName),
Expand Down

0 comments on commit ad7f0ab

Please sign in to comment.