mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 11:59:00 +08:00
Using a temporary dir instead of a specified dir within embed etcd test (#16694)
Signed-off-by: yun.zhang <yun.zhang@zilliz.com>
This commit is contained in:
parent
7017756601
commit
c0a73dbe98
@ -18,6 +18,7 @@ package etcdkv_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -38,12 +39,18 @@ func TestEmbedEtcd(te *testing.T) {
|
|||||||
param.Init()
|
param.Init()
|
||||||
param.BaseTable.Save("etcd.use.embed", "true")
|
param.BaseTable.Save("etcd.use.embed", "true")
|
||||||
param.BaseTable.Save("etcd.config.path", "../../../configs/advanced/etcd.yaml")
|
param.BaseTable.Save("etcd.config.path", "../../../configs/advanced/etcd.yaml")
|
||||||
param.BaseTable.Save("etcd.data.dir", "etcd.test.data.dir")
|
|
||||||
|
dir, err := ioutil.TempDir(os.TempDir(), "kv_etcd")
|
||||||
|
assert.Nil(te, err)
|
||||||
|
param.BaseTable.Save("etcd.data.dir", dir)
|
||||||
|
|
||||||
param.EtcdCfg.LoadCfgToMemory()
|
param.EtcdCfg.LoadCfgToMemory()
|
||||||
|
|
||||||
//clean up data
|
//clean up data
|
||||||
defer func() {
|
defer func() {
|
||||||
os.RemoveAll("etcd.test.data.dir")
|
err = os.RemoveAll(dir)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
te.Run("EtcdKV SaveAndLoad", func(t *testing.T) {
|
te.Run("EtcdKV SaveAndLoad", func(t *testing.T) {
|
||||||
rootPath := "/etcd/test/root/saveandload"
|
rootPath := "/etcd/test/root/saveandload"
|
||||||
metaKv, err := embed_etcd_kv.NewMetaKvFactory(rootPath, ¶m.EtcdCfg)
|
metaKv, err := embed_etcd_kv.NewMetaKvFactory(rootPath, ¶m.EtcdCfg)
|
||||||
|
Loading…
Reference in New Issue
Block a user