Просмотр исходного кода

Merge pull request #10316 from thalesmg/flaky-crl-emqtt-test-v50

test(crl): fix flaky test (v5.0)
Thales Macedo Garitezi 2 лет назад
Родитель
Сommit
06048ae4ff
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      apps/emqx/test/emqx_crl_cache_SUITE.erl

+ 14 - 1
apps/emqx/test/emqx_crl_cache_SUITE.erl

@@ -884,7 +884,20 @@ t_revoked(Config) ->
         {port, 8883}
     ]),
     process_flag(trap_exit, true),
-    ?assertMatch({error, {{shutdown, {tls_alert, {certificate_revoked, _}}}, _}}, emqtt:connect(C)),
+    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,
     ok.
 
 t_revoke_then_refresh(Config) ->