test(emqx_resource_health_check): add more test to

health_check_timeout_checker
This commit is contained in:
EMQ-YangM 2022-01-25 15:07:15 +08:00
parent cb9f14f658
commit d312f315ac
2 changed files with 11 additions and 0 deletions

View File

@ -140,6 +140,16 @@ t_query(_) ->
ok = emqx_resource:remove_local(?ID).
t_healthy_timeout(_) ->
{ok, _} = emqx_resource:create_local(
?ID,
?TEST_RESOURCE,
#{name => <<"test_resource">>},
#{async_create => true, health_check_timeout => 200}),
timer:sleep(500),
ok = emqx_resource:remove_local(?ID).
t_healthy(_) ->
{ok, _} = emqx_resource:create_local(
?ID,

View File

@ -61,6 +61,7 @@ on_query(_InstId, get_state_failed, AfterQuery, State) ->
State.
on_health_check(_InstId, State = #{pid := Pid}) ->
timer:sleep(300),
case is_process_alive(Pid) of
true -> {ok, State};
false -> {error, dead, State}