test(crl): ensure ssl_manager is ready to avoid flakiness
Example failure: https://github.com/emqx/emqx/actions/runs/4806430125/jobs/8555021522?pr=10524#step:8:49138
This commit is contained in:
parent
1557bf50e6
commit
99448151e9
|
@ -35,6 +35,7 @@ all() ->
|
|||
|
||||
init_per_suite(Config) ->
|
||||
application:load(emqx),
|
||||
{ok, _} = application:ensure_all_started(ssl),
|
||||
emqx_config:save_schema_mod_and_names(emqx_schema),
|
||||
emqx_common_test_helpers:boot_modules(all),
|
||||
Config.
|
||||
|
@ -328,7 +329,15 @@ drain_msgs() ->
|
|||
|
||||
clear_crl_cache() ->
|
||||
%% reset the CRL cache
|
||||
Ref = monitor(process, whereis(ssl_manager)),
|
||||
exit(whereis(ssl_manager), kill),
|
||||
receive
|
||||
{'DOWN', Ref, process, _, _} ->
|
||||
ok
|
||||
after 1_000 ->
|
||||
ct:fail("ssl_manager didn't die")
|
||||
end,
|
||||
ensure_ssl_manager_alive(),
|
||||
ok.
|
||||
|
||||
force_cacertfile(Cacertfile) ->
|
||||
|
@ -382,7 +391,6 @@ setup_crl_options(Config, #{is_cached := IsCached} = Opts) ->
|
|||
false ->
|
||||
%% ensure cache is empty
|
||||
clear_crl_cache(),
|
||||
ct:sleep(200),
|
||||
ok
|
||||
end,
|
||||
drain_msgs(),
|
||||
|
@ -459,6 +467,13 @@ of_kinds(Trace0, Kinds0) ->
|
|||
Trace0
|
||||
).
|
||||
|
||||
ensure_ssl_manager_alive() ->
|
||||
?retry(
|
||||
_Sleep0 = 200,
|
||||
_Attempts0 = 50,
|
||||
true = is_pid(whereis(ssl_manager))
|
||||
).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Test cases
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue