Fix bug of running unittest in parallel

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/4973/head^2
zhenshan.cao 2020-12-22 22:08:03 +08:00 committed by yefu.chen
parent 2aa483c922
commit 11316525e5
4 changed files with 14 additions and 13 deletions

View File

@ -42,24 +42,24 @@ func TestMetaService_getSegmentObjId(t *testing.T) {
}
func TestMetaService_isCollectionObj(t *testing.T) {
var key = "by-dev/meta/collection/collection0"
var key = Params.MetaRootPath + "/collection/collection0"
var b1 = isCollectionObj(key)
assert.Equal(t, b1, true)
key = "by-dev/meta/segment/segment0"
key = Params.MetaRootPath + "/segment/segment0"
var b2 = isCollectionObj(key)
assert.Equal(t, b2, false)
}
func TestMetaService_isSegmentObj(t *testing.T) {
var key = "by-dev/meta/segment/segment0"
var key = Params.MetaRootPath + "/segment/segment0"
var b1 = isSegmentObj(key)
assert.Equal(t, b1, true)
key = "by-dev/meta/collection/collection0"
key = Params.MetaRootPath + "/collection/collection0"
var b2 = isSegmentObj(key)
assert.Equal(t, b2, false)
@ -186,7 +186,7 @@ func TestMetaService_processCreate(t *testing.T) {
node := newQueryNode()
node.metaService = newMetaService(node.queryNodeLoopCtx, node.replica)
key1 := "by-dev/meta/collection/0"
key1 := Params.MetaRootPath + "/collection/0"
msg1 := `schema: <
name: "test"
fields: <
@ -222,7 +222,7 @@ func TestMetaService_processCreate(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, collection.ID(), UniqueID(0))
key2 := "by-dev/meta/segment/0"
key2 := Params.MetaRootPath + "/segment/0"
msg2 := `partition_tag: "default"
channel_start: 0
channel_end: 1
@ -378,7 +378,7 @@ func TestMetaService_processModify(t *testing.T) {
node := newQueryNode()
node.metaService = newMetaService(node.queryNodeLoopCtx, node.replica)
key1 := "by-dev/meta/collection/0"
key1 := Params.MetaRootPath + "/collection/0"
msg1 := `schema: <
name: "test"
fields: <
@ -429,7 +429,7 @@ func TestMetaService_processModify(t *testing.T) {
hasPartition = node.replica.hasPartition(UniqueID(0), "p3")
assert.Equal(t, hasPartition, false)
key2 := "by-dev/meta/segment/0"
key2 := Params.MetaRootPath + "/segment/0"
msg2 := `partition_tag: "p1"
channel_start: 0
channel_end: 1
@ -578,7 +578,7 @@ func TestMetaService_processDelete(t *testing.T) {
node := newQueryNode()
node.metaService = newMetaService(node.queryNodeLoopCtx, node.replica)
key1 := "by-dev/meta/collection/0"
key1 := Params.MetaRootPath + "/collection/0"
msg1 := `schema: <
name: "test"
fields: <
@ -614,7 +614,7 @@ func TestMetaService_processDelete(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, collection.ID(), UniqueID(0))
key2 := "by-dev/meta/segment/0"
key2 := Params.MetaRootPath + "/segment/0"
msg2 := `partition_tag: "default"
channel_start: 0
channel_end: 1

View File

@ -117,7 +117,7 @@ func TestParamTable_statsChannelName(t *testing.T) {
func TestParamTable_metaRootPath(t *testing.T) {
path := Params.MetaRootPath
assert.Equal(t, "by-dev/meta", path)
fmt.Println(path)
}
func TestParamTable_ddChannelName(t *testing.T) {

View File

@ -21,6 +21,7 @@ const closeWithDeadline = true
func setup() {
Params.Init()
Params.MetaRootPath = "/etcd/test/root/querynode"
}
func genTestCollectionMeta(collectionName string, collectionID UniqueID) *etcdpb.CollectionMeta {

View File

@ -13,9 +13,9 @@ func createMetaTable(t *testing.T) *metaTable {
etcdAddr := Params.EtcdAddress
cli, err := clientv3.New(clientv3.Config{Endpoints: []string{etcdAddr}})
assert.Nil(t, err)
etcdKV := etcdkv.NewEtcdKV(cli, "/etcd/test/root")
etcdKV := etcdkv.NewEtcdKV(cli, "/etcd/test/root/writer")
_, err = cli.Delete(context.TODO(), "/etcd/test/root", clientv3.WithPrefix())
_, err = cli.Delete(context.TODO(), "/etcd/test/root/writer", clientv3.WithPrefix())
assert.Nil(t, err)
meta, err := NewMetaTable(etcdKV)