mirror of https://github.com/milvus-io/milvus.git
Use embed ETCD for datacoord unit test (#21890)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/21873/head
parent
61c2f29ab3
commit
11a3d0a50b
|
@ -25,6 +25,7 @@ import (
|
|||
"os/signal"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
@ -61,6 +62,18 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// init embed etcd
|
||||
embedetcdServer, tempDir, err := etcd.StartTestEmbedEtcdServer()
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
defer os.RemoveAll(tempDir)
|
||||
defer embedetcdServer.Close()
|
||||
|
||||
addrs := etcd.GetEmbedEtcdEndpoints(embedetcdServer)
|
||||
// setup env for etcd endpoint
|
||||
os.Setenv("etcd.endpoints", strings.Join(addrs, ","))
|
||||
|
||||
paramtable.Init()
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
os.Exit(m.Run())
|
||||
|
|
Loading…
Reference in New Issue