未验证 提交 87dd4e8f 编写于 作者: J jaime 提交者: GitHub

Fix clean up data dir failed for TestEtcdRestartLoad (#15506)

Signed-off-by: Nyun.zhang <yun.zhang@zilliz.com>
上级 0ae0a1a7
......@@ -29,16 +29,18 @@ import (
)
func TestEtcdRestartLoad(te *testing.T) {
etcdDataDir := "/tmp/_etcd_data"
os.Setenv(metricsinfo.DeployModeEnvKey, metricsinfo.StandaloneDeployMode)
param := new(paramtable.ServiceParam)
param.Init()
param.BaseTable.Save("etcd.use.embed", "true")
// TODO, not sure if the relative path works for ci environment
param.BaseTable.Save("etcd.config.path", "../../../configs/advanced/etcd.yaml")
param.BaseTable.Save("etcd.data.dir", "etcd.test.data.dir")
param.BaseTable.Save("etcd.data.dir", etcdDataDir)
//clean up data
defer func() {
os.RemoveAll("etcd.test.data.dir")
err := os.RemoveAll(etcdDataDir)
assert.NoError(te, err)
}()
param.EtcdCfg.LoadCfgToMemory()
te.Run("EtcdKV SaveRestartAndLoad", func(t *testing.T) {
......@@ -87,5 +89,7 @@ func TestEtcdRestartLoad(te *testing.T) {
assert.NoError(t, err)
assert.Equal(t, test.value, val)
}
metaKv.Close()
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册