mirror of https://github.com/milvus-io/milvus.git
Use embed etcd for ConnectManager unit test (#21884)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/21890/head
parent
f1daef22a1
commit
d329cf33a0
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue