Fix timesync tests

Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
pull/4973/head^2
XuanYang-cn 2020-11-12 15:56:23 +08:00 committed by yefu.chen
parent 93bd786506
commit 85db2c0438
3 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,6 @@ on:
- docker-compose.yml
- Makefile
- '!**.md'
- '!**_test.go'
pull_request:
# file paths to consider in the event. Optional; defaults to all.
paths:
@ -24,7 +23,6 @@ on:
- docker-compose.yml
- Makefile
- '!**.md'
- '!**_test.go'
jobs:
ubuntu:

View File

@ -45,7 +45,7 @@ func (ttBarrier *softTimeTickBarrier) GetTimeTick() (Timestamp, error) {
ttBarrier.lastTt = ts
default:
if isEmpty {
if isEmpty || ttBarrier.closed {
continue
}
return ttBarrier.lastTt, nil

View File

@ -250,6 +250,7 @@ func TestTt_SoftTtBarrierGetTimeTickClose(t *testing.T) {
sttbarrier01.Close()
}()
wg1.Wait()
ts, err = sttbarrier01.GetTimeTick()
assert.NotNil(t, err)
assert.Equal(t, Timestamp(0), ts)
@ -279,15 +280,16 @@ func TestTt_SoftTtBarrierGetTimeTickCancel(t *testing.T) {
require.NotNil(t, sttbarrier)
sttbarrier.Start()
var wg sync.WaitGroup
wg.Add(1)
go func() {
time.Sleep(10 * time.Millisecond)
defer wg.Done()
cancel()
time.Sleep(10 * time.Millisecond)
sttbarrier.Close()
time.Sleep(100 * time.Millisecond)
}()
time.Sleep(20 * time.Millisecond)
wg.Wait()
ts, err := sttbarrier.GetTimeTick()
assert.NotNil(t, err)