From fa9afcd7e4610cac460fe3d27e110209f1f3d722 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 30 May 2023 13:46:04 -0300 Subject: [PATCH 1/3] test(quic_multistreams): attempt to fix flaky tests https://github.com/emqx/emqx/actions/runs/5122717037/jobs/9214950882#step:8:1757 ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - test_server:ts_tc failed on line 1782 Reason: {test_case_failed,Client <0.6075.5> did not die: stacktrace: {current_stacktrace, [{gen_statem,loop_receive,3, [{file,"gen_statem.erl"}, {line,1281}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"}, {line,240}]}]}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Testing lib.emqx.emqx_quic_multistreams_SUITE: *** FAILED test case 335 of 364 *** %%% emqx_quic_multistreams_SUITE ==> shutdown.abort_recv_shutdown.ctrl_stream_shutdown.t_multi_streams_remote_shutdown: FAILED %%% emqx_quic_multistreams_SUITE ==> {test_case_failed,"Client <0.6075.5> did not die: stacktrace: {current_stacktrace,\n [{gen_statem,loop_receive,3,\n [{file,\"gen_statem.erl\"},\n {line,1281}]},\n {proc_lib,init_p_do_apply,3,\n [{file,\"proc_lib.erl\"},\n {line,240}]}]}"} ``` ``` %%% emqx_quic_multistreams_SUITE ==> mstream.profiles.profile_max_throughput.pub_qos2.sub_qos2.qos.t_multi_streams_unsub: FAILED %%% emqx_quic_multistreams_SUITE ==> {{case_clause, {ok,#{packet_id => 8,properties => #{},reason_code => 0, reason_code_name => success, via => {quic,#Ref<0.686875463.2755788802.201649>, #Ref<0.686875463.2755788804.193527>}}}}, [{emqx_quic_multistreams_SUITE,t_multi_streams_unsub,1, [{file, "/home/thales/dev/emqx/emqx/apps/emqx/test/emqx_quic_multistreams_SUITE.erl"}, {line,1094}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6,[{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9,[{file,"test_server.erl"},{line,1224}]}]} ``` --- apps/emqx/test/emqx_quic_multistreams_SUITE.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl index b55a28206..1f4ccab88 100644 --- a/apps/emqx/test/emqx_quic_multistreams_SUITE.erl +++ b/apps/emqx/test/emqx_quic_multistreams_SUITE.erl @@ -24,6 +24,7 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("quicer/include/quicer.hrl"). -include_lib("emqx/include/emqx_mqtt.hrl"). +-include_lib("snabbkaffe/include/snabbkaffe.hrl"). suite() -> [{timetrap, {seconds, 30}}]. @@ -1089,6 +1090,11 @@ t_multi_streams_unsub(Config) -> ), emqtt:unsubscribe_via(C, SubVia, Topic), + ?retry( + _Sleep2 = 100, + _Attempts2 = 50, + false = emqx_router:has_routes(Topic) + ), case emqtt:publish_via(C, PubVia, Topic, #{}, <<6, 7, 8, 9>>, [{qos, PubQos}]) of ok when PubQos == 0 -> @@ -1569,7 +1575,7 @@ t_multi_streams_remote_shutdown(Config) -> ok = stop_emqx(), %% Client should be closed - assert_client_die(C, 100, 50). + assert_client_die(C, 100, 200). t_multi_streams_remote_shutdown_with_reconnect(Config) -> erlang:process_flag(trap_exit, true), From 98a99d47cb4d768d08f22856e8e8dcc839847c59 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 30 May 2023 14:03:14 -0300 Subject: [PATCH 2/3] test(shared_sub): attempt to reduce test flakiness https://github.com/emqx/emqx/actions/runs/5122717037/jobs/9215439237#step:8:565 ``` %%% emqx_shared_sub_SUITE ==> t_local_fallback: FAILED %%% emqx_shared_sub_SUITE ==> {{badmatch,<<"not yet?">>}, [{emqx_shared_sub_SUITE,t_local_fallback,1, [{file,"/__w/emqx/emqx/source/apps/emqx/test/emqx_shared_sub_SUITE.erl"}, {line,669}]}, ``` --- apps/emqx/test/emqx_shared_sub_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx/test/emqx_shared_sub_SUITE.erl b/apps/emqx/test/emqx_shared_sub_SUITE.erl index 506e97e4d..e66b42bc8 100644 --- a/apps/emqx/test/emqx_shared_sub_SUITE.erl +++ b/apps/emqx/test/emqx_shared_sub_SUITE.erl @@ -666,7 +666,7 @@ t_local_fallback(Config) when is_list(Config) -> {true, UsedSubPid1} = last_message(<<"hello1">>, [ConnPid1]), rpc:call(Node, emqx, publish, [Message2]), - {true, UsedSubPid2} = last_message(<<"hello2">>, [ConnPid1]), + {true, UsedSubPid2} = last_message(<<"hello2">>, [ConnPid1], 2_000), emqtt:stop(ConnPid1), stop_slave(Node), From 596f05f981e861455e1c2b140a6530242774f4b4 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Tue, 30 May 2023 15:48:48 -0300 Subject: [PATCH 3/3] test(channel): attempt to reduce test flakiness https://github.com/emqx/emqx/actions/runs/5124277038/jobs/9217362541?pr=10886#step:5:1582 ``` %%% emqx_channel_SUITE ==> t_handle_kicked_publish_will_msg: FAILED %%% emqx_channel_SUITE ==> will_message_not_published ``` --- apps/emqx/test/emqx_channel_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/emqx/test/emqx_channel_SUITE.erl b/apps/emqx/test/emqx_channel_SUITE.erl index 9f73ab163..e77bef90c 100644 --- a/apps/emqx/test/emqx_channel_SUITE.erl +++ b/apps/emqx/test/emqx_channel_SUITE.erl @@ -892,7 +892,7 @@ t_handle_kicked_publish_will_msg(_) -> ), receive {pub, Msg} -> ok - after 1_000 -> exit(will_message_not_published) + after 10_000 -> exit(will_message_not_published) end. t_handle_call_discard(_) ->