Merge pull request #11262 from thalesmg/fix-gcp-consumer-hc-20230712-master

fix(gcp_pubsub_consumer): fail health check when there are no workers
This commit is contained in:
Thales Macedo Garitezi 2023-07-13 15:09:02 -03:00 committed by GitHub
commit 0dff428efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -249,6 +249,8 @@ check_workers(InstanceId, Client) ->
#{return_values => true}
)
of
{ok, []} ->
connecting;
{ok, Values} ->
AllOk = lists:all(fun(S) -> S =:= subscription_ok end, Values),
case AllOk of

View File

@ -1004,7 +1004,27 @@ t_bridge_rule_action_source(Config) ->
ok.
t_on_get_status(Config) ->
ResourceId = resource_id(Config),
emqx_bridge_testlib:t_on_get_status(Config, #{failure_status => connecting}),
%% no workers alive
?retry(
_Interval0 = 200,
_NAttempts0 = 20,
?assertMatch({ok, connected}, emqx_resource_manager:health_check(ResourceId))
),
WorkerPids = get_pull_worker_pids(Config),
emqx_utils:pmap(
fun(Pid) ->
Ref = monitor(process, Pid),
exit(Pid, kill),
receive
{'DOWN', Ref, process, Pid, killed} ->
ok
end
end,
WorkerPids
),
?assertMatch({ok, connecting}, emqx_resource_manager:health_check(ResourceId)),
ok.
t_create_via_http_api(_Config) ->