Skip to content

Commit 1fa4fe2

Browse files
authored
Merge pull request #12775 from rabbitmq/fix-flakes
Fixes for test flakes
2 parents ad2354b + 4a925f9 commit 1fa4fe2

File tree

10 files changed

+289
-164
lines changed

10 files changed

+289
-164
lines changed

deps/oauth2_client/test/system_SUITE.erl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ init_per_group(https, Config) ->
104104
CertsDir = ?config(rmq_certsdir, Config0),
105105
CaCertFile = filename:join([CertsDir, "testca", "cacert.pem"]),
106106
WrongCaCertFile = filename:join([CertsDir, "server", "server.pem"]),
107-
[{group, https},
107+
[{group, https},
108108
{oauth_provider_id, <<"uaa">>},
109109
{oauth_provider, build_https_oauth_provider(<<"uaa">>, CaCertFile)},
110110
{oauth_provider_with_issuer, keep_only_issuer_and_ssl_options(
@@ -122,7 +122,7 @@ init_per_group(https_down, Config) ->
122122

123123
[{issuer, build_issuer("https")},
124124
{oauth_provider_id, <<"uaa">>},
125-
{oauth_provider, build_https_oauth_provider(<<"uaa">>, CaCertFile)} | Config];
125+
{oauth_provider, build_https_oauth_provider(<<"uaa">>, CaCertFile)} | Config0];
126126

127127
init_per_group(openid_configuration_with_path, Config) ->
128128
[{use_openid_configuration_with_path, true} | Config];
@@ -134,7 +134,7 @@ init_per_group(with_all_oauth_provider_settings, Config) ->
134134

135135
[{with_all_oauth_provider_settings, true},
136136
{oauth_provider_id, <<"uaa">>},
137-
{oauth_provider, build_https_oauth_provider(<<"uaa">>, CaCertFile)} | Config];
137+
{oauth_provider, build_https_oauth_provider(<<"uaa">>, CaCertFile)} | Config0];
138138

139139
init_per_group(without_all_oauth_providers_settings, Config) ->
140140
Config0 = rabbit_ct_helpers:run_setup_steps(Config),
@@ -144,7 +144,7 @@ init_per_group(without_all_oauth_providers_settings, Config) ->
144144
[{with_all_oauth_provider_settings, false},
145145
{oauth_provider_id, <<"uaa">>},
146146
{oauth_provider, keep_only_issuer_and_ssl_options(
147-
build_https_oauth_provider(<<"uaa">>, CaCertFile))} | Config];
147+
build_https_oauth_provider(<<"uaa">>, CaCertFile))} | Config0];
148148

149149
init_per_group(with_default_oauth_provider, Config) ->
150150
OAuthProvider = ?config(oauth_provider, Config),
@@ -283,9 +283,6 @@ init_per_testcase(TestCase, Config0) ->
283283
https ->
284284
start_https_oauth_server(?AUTH_PORT, ?config(rmq_certsdir, Config),
285285
ListOfExpectations);
286-
without_all_oauth_providers_settings ->
287-
start_https_oauth_server(?AUTH_PORT, ?config(rmq_certsdir, Config),
288-
ListOfExpectations);
289286
_ ->
290287
do_nothing
291288
end,
@@ -302,8 +299,6 @@ end_per_testcase(_, Config) ->
302299
case ?config(group, Config) of
303300
https ->
304301
stop_https_auth_server();
305-
without_all_oauth_providers_settings ->
306-
stop_https_auth_server();
307302
_ ->
308303
do_nothing
309304
end,

deps/rabbit/test/amqp_client_SUITE.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ init_per_testcase(Testcase, Config) ->
341341

342342
end_per_testcase(Testcase, Config) ->
343343
%% Assert that every testcase cleaned up.
344+
rabbit_ct_broker_helpers:rpc(Config, 0, ?MODULE, delete_queues, []),
344345
eventually(?_assertEqual([], rpc(Config, rabbit_amqqueue, list, []))),
345346
%% Wait for sessions to terminate before starting the next test case.
346347
eventually(?_assertEqual([], rpc(Config, rabbit_amqp_session, list_local, []))),
@@ -350,6 +351,10 @@ end_per_testcase(Testcase, Config) ->
350351
get_global_counters(Config))),
351352
rabbit_ct_helpers:testcase_finished(Config, Testcase).
352353

354+
delete_queues() ->
355+
[rabbit_amqqueue:delete(Q, false, false, <<"dummy">>)
356+
|| Q <- rabbit_amqqueue:list()].
357+
353358
reliable_send_receive_with_outcomes_classic_queue(Config) ->
354359
reliable_send_receive_with_outcomes(<<"classic">>, Config).
355360

deps/rabbit/test/amqp_filtex_SUITE.erl

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ properties_section(Config) ->
156156
ok = amqp10_client:flow_link_credit(Receiver1, 10, never),
157157
receive {amqp10_msg, Receiver1, R1M1} ->
158158
?assertEqual([<<"m1">>], amqp10_msg:body(R1M1))
159-
after 5000 -> ct:fail({missing_msg, ?LINE})
159+
after 30000 -> ct:fail({missing_msg, ?LINE})
160160
end,
161161
ok = assert_no_msg_received(?LINE),
162162
ok = detach_link_sync(Receiver1),
@@ -183,7 +183,7 @@ properties_section(Config) ->
183183
Session, <<"receiver 3">>, Address,
184184
unsettled, configuration, Filter3),
185185
receive {amqp10_event, {link, Receiver3, {attached, #'v1_0.attach'{}}}} -> ok
186-
after 5000 -> ct:fail({missing_event, ?LINE})
186+
after 30000 -> ct:fail({missing_event, ?LINE})
187187
end,
188188
ok = amqp10_client:flow_link_credit(Receiver3, 10, never),
189189
ok = assert_no_msg_received(?LINE),
@@ -205,7 +205,7 @@ properties_section(Config) ->
205205
source = #'v1_0.source'{filter = {map, ActualFilter}}}}}} ->
206206
?assertMatch([{{symbol,<<"rabbitmq:stream-offset-spec">>}, _}],
207207
ActualFilter)
208-
after 5000 -> ct:fail({missing_event, ?LINE})
208+
after 30000 -> ct:fail({missing_event, ?LINE})
209209
end,
210210
{ok, R4M1} = amqp10_client:get_msg(Receiver4),
211211
{ok, R4M2} = amqp10_client:get_msg(Receiver4),
@@ -271,6 +271,12 @@ application_properties_section(Config) ->
271271
{ok, Receiver0} = amqp10_client:attach_receiver_link(
272272
Session, <<"receiver 0">>, Address,
273273
unsettled, configuration, Filter0),
274+
%% Wait for the attach so the detach command won't fail
275+
receive {amqp10_event,
276+
{link, Receiver0, {attached, #'v1_0.attach'{}}}} ->
277+
ok
278+
after 30000 -> ct:fail({missing_event, ?LINE})
279+
end,
274280
ok = amqp10_client:flow_link_credit(Receiver0, 10, never),
275281
ok = assert_no_msg_received(?LINE),
276282
ok = detach_link_sync(Receiver0),
@@ -298,12 +304,12 @@ application_properties_section(Config) ->
298304
{{utf8, <<"k3">>}, false}
299305
]}},
300306
proplists:get_value({symbol, ?DESCRIPTOR_NAME_APPLICATION_PROPERTIES_FILTER}, ActualFilter1))
301-
after 5000 -> ct:fail({missing_event, ?LINE})
307+
after 30000 -> ct:fail({missing_event, ?LINE})
302308
end,
303309
ok = amqp10_client:flow_link_credit(Receiver1, 10, never),
304310
receive {amqp10_msg, Receiver1, R1M1} ->
305311
?assertEqual([<<"m1">>], amqp10_msg:body(R1M1))
306-
after 5000 -> ct:fail({missing_msg, ?LINE})
312+
after 30000 -> ct:fail({missing_msg, ?LINE})
307313
end,
308314
ok = assert_no_msg_received(?LINE),
309315
ok = detach_link_sync(Receiver1),
@@ -358,7 +364,7 @@ application_properties_section(Config) ->
358364
source = #'v1_0.source'{filter = {map, ActualFilter4}}}}}} ->
359365
?assertMatch([{{symbol,<<"rabbitmq:stream-offset-spec">>}, _}],
360366
ActualFilter4)
361-
after 5000 -> ct:fail({missing_event, ?LINE})
367+
after 30000 -> ct:fail({missing_event, ?LINE})
362368
end,
363369
{ok, R4M1} = amqp10_client:get_msg(Receiver4),
364370
{ok, R4M2} = amqp10_client:get_msg(Receiver4),
@@ -498,12 +504,12 @@ filter_few_messages_from_many(Config) ->
498504
receive {amqp10_msg, Receiver, M1} ->
499505
?assertEqual([<<"first msg">>], amqp10_msg:body(M1)),
500506
ok = amqp10_client:accept_msg(Receiver, M1)
501-
after 5000 -> ct:fail({missing_msg, ?LINE})
507+
after 30000 -> ct:fail({missing_msg, ?LINE})
502508
end,
503509
receive {amqp10_msg, Receiver, M2} ->
504510
?assertEqual([<<"last msg">>], amqp10_msg:body(M2)),
505511
ok = amqp10_client:accept_msg(Receiver, M2)
506-
after 5000 -> ct:fail({missing_msg, ?LINE})
512+
after 30000 -> ct:fail({missing_msg, ?LINE})
507513
end,
508514
ok = detach_link_sync(Receiver),
509515

@@ -576,7 +582,7 @@ string_modifier(Config) ->
576582
ok = amqp10_client:flow_link_credit(Receiver1, 10, never),
577583
receive {amqp10_msg, Receiver1, R1M1} ->
578584
?assertEqual([<<"m1">>], amqp10_msg:body(R1M1))
579-
after 5000 -> ct:fail({missing_msg, ?LINE})
585+
after 30000 -> ct:fail({missing_msg, ?LINE})
580586
end,
581587
ok = assert_no_msg_received(?LINE),
582588
ok = detach_link_sync(Receiver1),
@@ -604,11 +610,11 @@ string_modifier(Config) ->
604610
ok = amqp10_client:flow_link_credit(Receiver3, 10, never),
605611
receive {amqp10_msg, Receiver3, R3M1} ->
606612
?assertEqual([<<"m1">>], amqp10_msg:body(R3M1))
607-
after 5000 -> ct:fail({missing_msg, ?LINE})
613+
after 30000 -> ct:fail({missing_msg, ?LINE})
608614
end,
609615
receive {amqp10_msg, Receiver3, R3M3} ->
610616
?assertEqual([<<"m3">>], amqp10_msg:body(R3M3))
611-
after 5000 -> ct:fail({missing_msg, ?LINE})
617+
after 30000 -> ct:fail({missing_msg, ?LINE})
612618
end,
613619
ok = detach_link_sync(Receiver3),
614620

deps/rabbitmq_ct_helpers/src/rabbit_ct_helpers.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,14 @@ ensure_rabbitmq_queues_cmd(Config) ->
597597

598598
ensure_ssl_certs(Config) ->
599599
SrcDir = ?config(rabbitmq_ct_helpers_srcdir, Config),
600+
UniqueDir = io_lib:format(
601+
"~s2-~p",
602+
[node(), erlang:unique_integer([positive,monotonic])]),
600603
CertsMakeDir = filename:join([SrcDir, "tools", "tls-certs"]),
601604
PrivDir = ?config(priv_dir, Config),
602-
CertsDir = filename:join(PrivDir, "certs"),
605+
CertsDir = filename:join([PrivDir, UniqueDir, "certs"]),
606+
_ = filelib:ensure_dir(CertsDir),
607+
_ = file:make_dir(CertsDir),
603608
CertsPwd = proplists:get_value(rmq_certspwd, Config, ?SSL_CERT_PASSWORD),
604609
Cmd = [
605610
"PASSWORD=" ++ CertsPwd,

0 commit comments

Comments
 (0)