fix(jwt_sup): delete the worker spec from the supervision tree
This commit is contained in:
parent
823efbaed3
commit
ea209585b5
|
@ -62,8 +62,10 @@ ensure_worker_present(Id, Config) ->
|
|||
-spec ensure_worker_deleted(worker_id()) -> ok.
|
||||
ensure_worker_deleted(Id) ->
|
||||
case supervisor:terminate_child(?MODULE, Id) of
|
||||
ok -> ok;
|
||||
{error, not_found} -> ok
|
||||
ok ->
|
||||
ok = supervisor:delete_child(?MODULE, Id);
|
||||
{error, not_found} ->
|
||||
ok
|
||||
end.
|
||||
|
||||
jwt_worker_child_spec(Id, Config) ->
|
||||
|
|
|
@ -259,4 +259,6 @@ t_start_supervised_worker(_Config) ->
|
|||
%% ensure it cleans up its own tokens to avoid leakage when
|
||||
%% probing/testing rule resources.
|
||||
?assertEqual({error, not_found}, emqx_rule_engine_jwt:lookup_jwt(TId, ResourceId)),
|
||||
%% ensure the specs are removed from the supervision tree.
|
||||
?assertEqual([], supervisor:which_children(emqx_rule_engine_jwt_sup)),
|
||||
ok.
|
||||
|
|
Loading…
Reference in New Issue