Skip to content

Commit 0bae90c

Browse files
Merge pull request #3158 from rabbitmq/mk-stricter-stop-start-assertions-in-quorum-queue-suite
Improve assertions in a QQ suite test (cherry picked from commit b3934b4)
1 parent 3667466 commit 0bae90c

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

deps/rabbit/test/quorum_queue_SUITE.erl

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,16 +644,29 @@ stop_start_rabbit_app(Config) ->
644644
?assertEqual({'queue.declare_ok', CQ2, 0, 0}, declare(Ch, CQ2, [])),
645645
rabbit_ct_client_helpers:publish(Ch, CQ2, 1),
646646

647-
rabbit_control_helper:command(stop_app, Server),
647+
?assertEqual(ok, rabbit_control_helper:command(stop_app, Server)),
648648
%% Check the ra application has stopped (thus its supervisor and queues)
649-
?assertMatch(false, lists:keyfind(ra, 1,
650-
rpc:call(Server, application, which_applications, []))),
649+
rabbit_ct_helpers:await_condition(
650+
fun() ->
651+
Apps = rpc:call(Server, application, which_applications, []),
652+
%% we expect the app to NOT be running
653+
case lists:keyfind(ra, 1, Apps) of
654+
false -> true;
655+
{ra, _, _} -> false
656+
end
657+
end),
651658

652-
rabbit_control_helper:command(start_app, Server),
659+
?assertEqual(ok, rabbit_control_helper:command(start_app, Server)),
653660

654661
%% Check that the application and two ra nodes are up
655-
?assertMatch({ra, _, _}, lists:keyfind(ra, 1,
656-
rpc:call(Server, application, which_applications, []))),
662+
rabbit_ct_helpers:await_condition(
663+
fun() ->
664+
Apps = rpc:call(Server, application, which_applications, []),
665+
case lists:keyfind(ra, 1, Apps) of
666+
false -> false;
667+
{ra, _, _} -> true
668+
end
669+
end),
657670
Expected = Children + 2,
658671
?assertMatch(Expected,
659672
length(rpc:call(Server, supervisor, which_children, [?SUPNAME]))),

0 commit comments

Comments
 (0)