Skip to content

Commit d217564

Browse files
committed
Use awaitMatch on QQ status fields too
I thought that asserting the right membership status on all nodes would guarantee that the other status fields would be the expected ones but it seems like that assumption was wrong.
1 parent 4ca6abc commit d217564

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

deps/rabbit/test/quorum_queue_SUITE.erl

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,6 +4934,14 @@ replica_states(Config) ->
49344934

49354935
% Testcase motivated by : https://github.com/rabbitmq/rabbitmq-server/discussions/13131
49364936
restart_after_queue_reincarnation(Config) ->
4937+
case rabbit_ct_helpers:is_mixed_versions() of
4938+
true ->
4939+
{skip, "queue reincarnation protection can't work on mixed mode"};
4940+
false ->
4941+
restart_after_queue_reincarnation_(Config)
4942+
end.
4943+
4944+
restart_after_queue_reincarnation_(Config) ->
49374945
[S1, S2, S3] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
49384946
Ch = rabbit_ct_client_helpers:open_channel(Config, S1),
49394947
QName = <<"QQ">>,
@@ -4997,25 +5005,31 @@ restart_after_queue_reincarnation(Config) ->
49975005
lists:member(NodeRaftState, [leader, follower])
49985006
end, Status2)
49995007
end, ?DEFAULT_AWAIT),
5000-
Status2 = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, status, [VHost, QName]),
5001-
5002-
% Remove "Node Name" and "Raft State" from the status.
5003-
Status3 = [NE1, NE2, NE3]= [
5004-
begin
5005-
R = proplists:delete(<<"Node Name">>, NodeEntry),
5006-
proplists:delete(<<"Raft State">>, R)
5007-
end || NodeEntry <- Status2],
5008-
% Check all other properties have same value on all nodes.
5009-
ct:pal("Status3: ~tp", [Status3]),
5010-
[
5011-
begin
5012-
?assertEqual({K, V}, {K, proplists:get_value(K, NE2)}),
5013-
?assertEqual({K, V}, {K, proplists:get_value(K, NE3)})
5014-
end || {K, V} <- NE1
5015-
].
5008+
?awaitMatch(true, begin
5009+
Status2 = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, status, [VHost, QName]),
5010+
5011+
% Remove "Node Name" and "Raft State" from the status.
5012+
Status3 = [NE1, NE2, NE3]= [
5013+
begin
5014+
R = proplists:delete(<<"Node Name">>, NodeEntry),
5015+
proplists:delete(<<"Raft State">>, R)
5016+
end || NodeEntry <- Status2],
5017+
% Check all other properties have same value on all nodes.
5018+
ct:pal("Status3: ~tp", [Status3]),
5019+
lists:all(fun({A, B}) -> A == B end, [ {V, proplists:get_value(K, NE2)} || {K, V} <- NE1]) andalso
5020+
lists:all(fun({A, B}) -> A == B end, [ {V, proplists:get_value(K, NE3)} || {K, V} <- NE1])
5021+
end, ?DEFAULT_AWAIT).
50165022

50175023
% Testcase motivated by : https://github.com/rabbitmq/rabbitmq-server/issues/12366
50185024
no_messages_after_queue_reincarnation(Config) ->
5025+
case rabbit_ct_helpers:is_mixed_versions() of
5026+
true ->
5027+
{skip, "queue reincarnation protection can't work on mixed mode"};
5028+
false ->
5029+
no_messages_after_queue_reincarnation_(Config)
5030+
end.
5031+
5032+
no_messages_after_queue_reincarnation_(Config) ->
50195033
[S1, S2, S3] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
50205034
Ch = rabbit_ct_client_helpers:open_channel(Config, S1),
50215035
QName = <<"QQ">>,

0 commit comments

Comments
 (0)