From 4f1ec795ebbb0cbb3f98c6968cc512dc26c70d6e Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 18 Sep 2023 17:08:01 +0200 Subject: [PATCH] test: delete special handling of emqtt race condition the race should have been fixed in emqtt 1.8.7 --- apps/emqx/test/emqx_crl_cache_SUITE.erl | 31 ++++++++----------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/apps/emqx/test/emqx_crl_cache_SUITE.erl b/apps/emqx/test/emqx_crl_cache_SUITE.erl index 248013ce9..3d02d02ca 100644 --- a/apps/emqx/test/emqx_crl_cache_SUITE.erl +++ b/apps/emqx/test/emqx_crl_cache_SUITE.erl @@ -924,8 +924,8 @@ t_not_cached_and_unreachable(Config) -> ]), Ref = get_crl_cache_table(), ?assertEqual([], ets:tab2list(Ref)), - process_flag(trap_exit, true), - ?assertMatch({error, {{shutdown, {tls_alert, {bad_certificate, _}}}, _}}, emqtt:connect(C)), + unlink(C), + ?assertMatch({error, {ssl_error, _Sock, {tls_alert, {bad_certificate, _}}}}, emqtt:connect(C)), ok. t_revoked(Config) -> @@ -940,21 +940,10 @@ t_revoked(Config) -> ]}, {port, 8883} ]), - process_flag(trap_exit, true), - Res = emqtt:connect(C), - %% apparently, sometimes there's some race condition in - %% `emqtt_sock:ssl_upgrade' when it calls - %% `ssl:conetrolling_process' and a bad match happens at that - %% point. - case Res of - {error, {{shutdown, {tls_alert, {certificate_revoked, _}}}, _}} -> - ok; - {error, closed} -> - %% race condition? - ok; - _ -> - ct:fail("unexpected result: ~p", [Res]) - end, + unlink(C), + ?assertMatch( + {error, {ssl_error, _Sock, {tls_alert, {certificate_revoked, _}}}}, emqtt:connect(C) + ), ok. t_revoke_then_refresh(Config) -> @@ -993,9 +982,9 @@ t_revoke_then_refresh(Config) -> ]}, {port, 8883} ]), - process_flag(trap_exit, true), + unlink(C1), ?assertMatch( - {error, {{shutdown, {tls_alert, {certificate_revoked, _}}}, _}}, emqtt:connect(C1) + {error, {ssl_error, _Sock, {tls_alert, {certificate_revoked, _}}}}, emqtt:connect(C1) ), ok. @@ -1068,7 +1057,6 @@ do_t_update_listener(Config) -> ), %% Now should use CRL information to block connection - process_flag(trap_exit, true), {ok, C1} = emqtt:start_link([ {ssl, true}, {ssl_opts, [ @@ -1077,8 +1065,9 @@ do_t_update_listener(Config) -> ]}, {port, 8883} ]), + unlink(C1), ?assertMatch( - {error, {{shutdown, {tls_alert, {certificate_revoked, _}}}, _}}, emqtt:connect(C1) + {error, {ssl_error, _Sock, {tls_alert, {certificate_revoked, _}}}}, emqtt:connect(C1) ), assert_http_get(<>),