From b846220ffdbe6c1699921c9aeff4f549d96163e3 Mon Sep 17 00:00:00 2001 From: Shawn <506895667@qq.com> Date: Sat, 28 May 2022 17:15:56 +0800 Subject: [PATCH] fix(test): discard already_started error for gpc test server --- apps/emqx_gateway/test/emqx_exproto_echo_svr.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/emqx_gateway/test/emqx_exproto_echo_svr.erl b/apps/emqx_gateway/test/emqx_exproto_echo_svr.erl index ecc8999ce..25f25ba0c 100644 --- a/apps/emqx_gateway/test/emqx_exproto_echo_svr.erl +++ b/apps/emqx_gateway/test/emqx_exproto_echo_svr.erl @@ -106,10 +106,13 @@ end). start() -> application:ensure_all_started(grpc), - [start_channel(), start_server()]. + [ensure_channel(), start_server()]. -start_channel() -> - grpc_client_sup:create_channel_pool(ct_test_channel, "http://127.0.0.1:9100", #{}). +ensure_channel() -> + case grpc_client_sup:create_channel_pool(ct_test_channel, "http://127.0.0.1:9100", #{}) of + {error, {already_started, Pid}} -> {ok, Pid}; + {ok, Pid} -> {ok, Pid} + end. start_server() -> Services = #{