Skip to content

Commit 66e806e

Browse files
Merge pull request #9438 from rabbitmq/test-resilience
2 parents d00d03c + 08ed15a commit 66e806e

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

deps/rabbit/app.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ def test_suite_beam_files(name = "test_suite_beam_files"):
10251025
outs = ["test/logging_SUITE.beam"],
10261026
app_name = "rabbit",
10271027
erlc_opts = "//:test_erlc_opts",
1028-
deps = ["//deps/amqp_client:erlang_app", "//deps/rabbit_common:erlang_app"],
1028+
deps = ["//deps/amqp_client:erlang_app", "//deps/rabbit_common:erlang_app", "//deps/rabbitmq_ct_helpers:erlang_app"],
10291029
)
10301030
erlang_bytecode(
10311031
name = "lqueue_SUITE_beam_files",

deps/rabbit/test/logging_SUITE.erl

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
-include_lib("kernel/include/logger.hrl").
1414
-include_lib("rabbit_common/include/logging.hrl").
1515
-include_lib("amqp_client/include/amqp_client.hrl").
16+
-include_lib("rabbitmq_ct_helpers/include/rabbit_assert.hrl").
1617

1718
-export([suite/0,
1819
all/0,
@@ -922,18 +923,10 @@ logging_to_exchange_works(Config) ->
922923
#{exchange := #resource{name = XName} = Exchange}} = ExchangeHandler,
923924

924925
%% Wait for the expected exchange to be automatically declared.
925-
?assert(
926-
lists:any(
927-
fun(_) ->
928-
Ret = rabbit_ct_broker_helpers:rpc(
929-
Config, 0,
930-
rabbit_exchange, lookup, [Exchange]),
931-
case Ret of
932-
{ok, _} -> true;
933-
_ -> timer:sleep(500),
934-
false
935-
end
936-
end, lists:seq(1, 20))),
926+
?awaitMatch({ok, _}, rabbit_ct_broker_helpers:rpc(
927+
Config, 0,
928+
rabbit_exchange, lookup, [Exchange]),
929+
10000),
937930

938931
%% Declare a queue to collect all logged messages.
939932
{Conn, Chan} = rabbit_ct_client_helpers:open_connection_and_channel(

deps/rabbit/test/rabbit_fifo_dlx_integration_SUITE.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
-import(queue_utils, [wait_for_messages_ready/3,
2222
wait_for_min_messages/3,
23+
wait_for_messages/2,
2324
dirty_query/3,
2425
ra_name/1]).
2526
-import(rabbit_ct_helpers, [eventually/1,
@@ -639,9 +640,10 @@ reject_publish_max_length_target_quorum_queue(Config) ->
639640
%% Make space in target queue by consuming messages one by one
640641
%% allowing for more dead-lettered messages to reach the target queue.
641642
[begin
642-
timer:sleep(2000),
643643
Msg = integer_to_binary(N),
644-
{#'basic.get_ok'{}, #amqp_msg{payload = Msg}} = amqp_channel:call(Ch, #'basic.get'{queue = TargetQ})
644+
?awaitMatch({#'basic.get_ok'{}, #amqp_msg{payload = Msg}},
645+
amqp_channel:call(Ch, #'basic.get'{queue = TargetQ}),
646+
?DEFAULT_WAIT, ?DEFAULT_INTERVAL)
645647
end || N <- lists:seq(1,4)],
646648
eventually(?_assertEqual([{0, 0}],
647649
dirty_query([Server], RaName, fun rabbit_fifo:query_stat_dlx/1)), 500, 10),
@@ -686,7 +688,7 @@ reject_publish_down_target_quorum_queue(Config) ->
686688
end || N <- lists:seq(21, 50)],
687689

688690
%% The target queue should have all 50 messages.
689-
timer:sleep(2000),
691+
wait_for_messages(Config, [[TargetQ, <<"50">>, <<"50">>, <<"0">>]]),
690692
Received = lists:foldl(
691693
fun(_N, S) ->
692694
{#'basic.get_ok'{}, #amqp_msg{payload = Msg}} =

0 commit comments

Comments
 (0)