未验证 提交 e4e762f2 编写于 作者: G groot 提交者: GitHub

Reduce go unittest time cost (#8503)

Signed-off-by: Nyhmo <yihua.mo@zilliz.com>
上级 a6a64692
......@@ -386,7 +386,7 @@ func TestDataNode(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(node.vchan2FlushCh))
require.Equal(t, 1, len(node.vchan2SyncService))
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
node.ReleaseDataSyncService(dmChannelName)
assert.Equal(t, 0, len(node.vchan2FlushCh))
......
......@@ -112,7 +112,7 @@ func TestIndexCoord(t *testing.T) {
resp.States[0].State == commonpb.IndexState_Failed {
break
}
time.Sleep(1 * time.Second)
time.Sleep(100 * time.Millisecond)
}
})
......@@ -182,7 +182,7 @@ func TestIndexCoord(t *testing.T) {
indexMeta := ic.metaTable.GetIndexMetaByIndexBuildID(indexBuildID)
for indexMeta != nil {
indexMeta = ic.metaTable.GetIndexMetaByIndexBuildID(indexBuildID)
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
})
......
......@@ -170,7 +170,7 @@ func TestIndexNode(t *testing.T) {
err = proto.UnmarshalText(value, &indexMetaTmp)
assert.Nil(t, err)
for indexMetaTmp.State != commonpb.IndexState_Finished {
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
value, err = in.etcdKV.Load(metaPath1)
assert.Nil(t, err)
err = proto.UnmarshalText(value, &indexMetaTmp)
......@@ -280,7 +280,7 @@ func TestIndexNode(t *testing.T) {
err = proto.UnmarshalText(value, &indexMetaTmp)
assert.Nil(t, err)
for indexMetaTmp.State != commonpb.IndexState_Finished {
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
value, err = in.etcdKV.Load(metaPath2)
assert.Nil(t, err)
err = proto.UnmarshalText(value, &indexMetaTmp)
......@@ -574,7 +574,7 @@ func TestCreateIndexFailed(t *testing.T) {
err = proto.UnmarshalText(value, &indexMetaTmp)
assert.Nil(t, err)
for indexMetaTmp.State != commonpb.IndexState_Failed {
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
value, err = in.etcdKV.Load(metaPath1)
assert.Nil(t, err)
err = proto.UnmarshalText(value, &indexMetaTmp)
......@@ -692,7 +692,7 @@ func TestCreateIndexFailed(t *testing.T) {
err = proto.UnmarshalText(value, &indexMetaTmp)
assert.Nil(t, err)
for indexMetaTmp.State != commonpb.IndexState_Failed {
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
value, err = in.etcdKV.Load(metaPath2)
assert.Nil(t, err)
err = proto.UnmarshalText(value, &indexMetaTmp)
......
......@@ -495,7 +495,7 @@ func TestElapse(t *testing.T) {
isElapse := etcdkv.CheckElapseAndWarn(start, "err message")
assert.Equal(t, isElapse, false)
time.Sleep(time.Duration(3) * time.Second)
time.Sleep(2001 * time.Millisecond)
isElapse = etcdkv.CheckElapseAndWarn(start, "err message")
assert.Equal(t, isElapse, true)
}
......@@ -68,7 +68,7 @@ func TestChannelsTimeTickerImpl_start(t *testing.T) {
assert.Equal(t, nil, err)
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
func TestChannelsTimeTickerImpl_close(t *testing.T) {
......@@ -90,7 +90,7 @@ func TestChannelsTimeTickerImpl_close(t *testing.T) {
assert.Equal(t, nil, err)
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
func TestChannelsTimeTickerImpl_addPChan(t *testing.T) {
......@@ -118,7 +118,7 @@ func TestChannelsTimeTickerImpl_addPChan(t *testing.T) {
assert.Equal(t, nil, err)
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
func TestChannelsTimeTickerImpl_getLastTick(t *testing.T) {
......@@ -156,7 +156,7 @@ func TestChannelsTimeTickerImpl_getLastTick(t *testing.T) {
}
}
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
b <- struct{}{}
wg.Wait()
......@@ -165,7 +165,7 @@ func TestChannelsTimeTickerImpl_getLastTick(t *testing.T) {
assert.Equal(t, nil, err)
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
func TestChannelsTimeTickerImpl_getMinTsStatistics(t *testing.T) {
......@@ -203,7 +203,7 @@ func TestChannelsTimeTickerImpl_getMinTsStatistics(t *testing.T) {
}
}
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
b <- struct{}{}
wg.Wait()
......@@ -212,5 +212,5 @@ func TestChannelsTimeTickerImpl_getMinTsStatistics(t *testing.T) {
assert.Equal(t, nil, err)
}()
time.Sleep(time.Second)
time.Sleep(100 * time.Millisecond)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册