Merge pull request #10530 from thalesmg/fix-wait-ssl-crl-test-v50
test(crl): ensure ssl_manager is ready to avoid flakiness
This commit is contained in:
commit
c984449bad
|
@ -35,6 +35,7 @@ all() ->
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
application:load(emqx),
|
application:load(emqx),
|
||||||
|
{ok, _} = application:ensure_all_started(ssl),
|
||||||
emqx_config:save_schema_mod_and_names(emqx_schema),
|
emqx_config:save_schema_mod_and_names(emqx_schema),
|
||||||
emqx_common_test_helpers:boot_modules(all),
|
emqx_common_test_helpers:boot_modules(all),
|
||||||
Config.
|
Config.
|
||||||
|
@ -328,7 +329,15 @@ drain_msgs() ->
|
||||||
|
|
||||||
clear_crl_cache() ->
|
clear_crl_cache() ->
|
||||||
%% reset the CRL cache
|
%% reset the CRL cache
|
||||||
|
Ref = monitor(process, whereis(ssl_manager)),
|
||||||
exit(whereis(ssl_manager), kill),
|
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.
|
ok.
|
||||||
|
|
||||||
force_cacertfile(Cacertfile) ->
|
force_cacertfile(Cacertfile) ->
|
||||||
|
@ -382,7 +391,6 @@ setup_crl_options(Config, #{is_cached := IsCached} = Opts) ->
|
||||||
false ->
|
false ->
|
||||||
%% ensure cache is empty
|
%% ensure cache is empty
|
||||||
clear_crl_cache(),
|
clear_crl_cache(),
|
||||||
ct:sleep(200),
|
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
drain_msgs(),
|
drain_msgs(),
|
||||||
|
@ -459,6 +467,13 @@ of_kinds(Trace0, Kinds0) ->
|
||||||
Trace0
|
Trace0
|
||||||
).
|
).
|
||||||
|
|
||||||
|
ensure_ssl_manager_alive() ->
|
||||||
|
?retry(
|
||||||
|
_Sleep0 = 200,
|
||||||
|
_Attempts0 = 50,
|
||||||
|
true = is_pid(whereis(ssl_manager))
|
||||||
|
).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Test cases
|
%% Test cases
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue