test: start emqx_opentelemetry in emqx_machine SUITE

This commit is contained in:
zhongwencool 2023-08-25 05:54:40 +08:00
parent c215fe3736
commit 8ab6eb5638
2 changed files with 13 additions and 7 deletions

View File

@ -42,7 +42,7 @@ init_per_suite(Config) ->
%% Unload emqx_authz to avoid reboot this application %% Unload emqx_authz to avoid reboot this application
%% %%
application:unload(emqx_authz), application:unload(emqx_authz),
emqx_common_test_helpers:start_apps([emqx_conf]), emqx_common_test_helpers:start_apps([emqx_conf, emqx_opentelemetry]),
application:set_env(emqx_machine, applications, [ application:set_env(emqx_machine, applications, [
emqx_prometheus, emqx_prometheus,
emqx_modules, emqx_modules,
@ -56,12 +56,13 @@ init_per_suite(Config) ->
emqx_exhook, emqx_exhook,
emqx_authn, emqx_authn,
emqx_authz, emqx_authz,
emqx_plugin emqx_plugin,
emqx_opentelemetry
]), ]),
Config. Config.
end_per_suite(_Config) -> end_per_suite(_Config) ->
emqx_common_test_helpers:stop_apps([]). emqx_common_test_helpers:stop_apps([emqx_opentelemetry, emqx_conf]).
init_per_testcase(t_custom_shard_transports, Config) -> init_per_testcase(t_custom_shard_transports, Config) ->
OldConfig = application:get_env(emqx_machine, custom_shard_transports), OldConfig = application:get_env(emqx_machine, custom_shard_transports),

View File

@ -30,10 +30,15 @@ start_otel(Conf) ->
stop_otel() -> stop_otel() ->
ok = cleanup(), ok = cleanup(),
case supervisor:terminate_child(?SUPERVISOR, ?MODULE) of case erlang:whereis(?SUPERVISOR) of
ok -> supervisor:delete_child(?SUPERVISOR, ?MODULE); undefined ->
ok;
Pid ->
case supervisor:terminate_child(Pid, ?MODULE) of
ok -> supervisor:delete_child(Pid, ?MODULE);
{error, not_found} -> ok; {error, not_found} -> ok;
Error -> Error Error -> Error
end
end. end.
start_link(Conf) -> start_link(Conf) ->