未验证 提交 d329cf33 编写于 作者: C congqixia 提交者: GitHub

Use embed etcd for ConnectManager unit test (#21884)

Signed-off-by: NCongqi Xia <congqi.xia@zilliz.com>
上级 f1daef22
......@@ -40,8 +40,26 @@ import (
"google.golang.org/grpc"
)
func TestConnectionManager(t *testing.T) {
func TestMain(t *testing.M) {
// init embed etcd
embedetcdServer, tempDir, err := etcd.StartTestEmbedEtcdServer()
if err != nil {
log.Fatal("failed to start embed etcd server for unittest", zap.Error(err))
}
defer os.RemoveAll(tempDir)
defer embedetcdServer.Server.Stop()
addrs := etcd.GetEmbedEtcdEndpoints(embedetcdServer)
// setup env for etcd endpoint
os.Setenv("etcd.endpoints", strings.Join(addrs, ","))
paramtable.Init()
os.Exit(t.Run())
}
func TestConnectionManager(t *testing.T) {
ctx := context.Background()
session := initSession(ctx)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册