Skip to content

Commit 1a079fe

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 821101f commit 1a079fe

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
@@ -4900,6 +4900,14 @@ replica_states(Config) ->
49004900

49014901
% Testcase motivated by : https://github.com/rabbitmq/rabbitmq-server/discussions/13131
49024902
restart_after_queue_reincarnation(Config) ->
4903+
case rabbit_ct_helpers:is_mixed_versions() of
4904+
true ->
4905+
{skip, "queue reincarnation protection can't work on mixed mode"};
4906+
false ->
4907+
restart_after_queue_reincarnation_(Config)
4908+
end.
4909+
4910+
restart_after_queue_reincarnation_(Config) ->
49034911
[S1, S2, S3] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
49044912
Ch = rabbit_ct_client_helpers:open_channel(Config, S1),
49054913
QName = <<"QQ">>,
@@ -4963,25 +4971,31 @@ restart_after_queue_reincarnation(Config) ->
49634971
lists:member(NodeRaftState, [leader, follower])
49644972
end, Status2)
49654973
end, ?DEFAULT_AWAIT),
4966-
Status2 = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, status, [VHost, QName]),
4967-
4968-
% Remove "Node Name" and "Raft State" from the status.
4969-
Status3 = [NE1, NE2, NE3]= [
4970-
begin
4971-
R = proplists:delete(<<"Node Name">>, NodeEntry),
4972-
proplists:delete(<<"Raft State">>, R)
4973-
end || NodeEntry <- Status2],
4974-
% Check all other properties have same value on all nodes.
4975-
ct:pal("Status3: ~tp", [Status3]),
4976-
[
4977-
begin
4978-
?assertEqual({K, V}, {K, proplists:get_value(K, NE2)}),
4979-
?assertEqual({K, V}, {K, proplists:get_value(K, NE3)})
4980-
end || {K, V} <- NE1
4981-
].
4974+
?awaitMatch(true, begin
4975+
Status2 = rabbit_ct_broker_helpers:rpc(Config, 0, rabbit_quorum_queue, status, [VHost, QName]),
4976+
4977+
% Remove "Node Name" and "Raft State" from the status.
4978+
Status3 = [NE1, NE2, NE3]= [
4979+
begin
4980+
R = proplists:delete(<<"Node Name">>, NodeEntry),
4981+
proplists:delete(<<"Raft State">>, R)
4982+
end || NodeEntry <- Status2],
4983+
% Check all other properties have same value on all nodes.
4984+
ct:pal("Status3: ~tp", [Status3]),
4985+
lists:all(fun({A, B}) -> A == B end, [ {V, proplists:get_value(K, NE2)} || {K, V} <- NE1]) andalso
4986+
lists:all(fun({A, B}) -> A == B end, [ {V, proplists:get_value(K, NE3)} || {K, V} <- NE1])
4987+
end, ?DEFAULT_AWAIT).
49824988

49834989
% Testcase motivated by : https://github.com/rabbitmq/rabbitmq-server/issues/12366
49844990
no_messages_after_queue_reincarnation(Config) ->
4991+
case rabbit_ct_helpers:is_mixed_versions() of
4992+
true ->
4993+
{skip, "queue reincarnation protection can't work on mixed mode"};
4994+
false ->
4995+
no_messages_after_queue_reincarnation_(Config)
4996+
end.
4997+
4998+
no_messages_after_queue_reincarnation_(Config) ->
49854999
[S1, S2, S3] = rabbit_ct_broker_helpers:get_node_configs(Config, nodename),
49865000
Ch = rabbit_ct_client_helpers:open_channel(Config, S1),
49875001
QName = <<"QQ">>,

0 commit comments

Comments
 (0)