Fix Group Checker test fail (#20911)

Signed-off-by: lixinguo <xinguo.li@zilliz.com>

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/20928/head
smellthemoon 2022-12-01 13:39:15 +08:00 committed by GitHub
parent 82fe655032
commit f7d603f947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,9 @@ import (
func TestGroupChecker(t *testing.T) {
groupName := `test_group`
signal := make(chan []string, 1)
gc1 := GetGroupChecker(groupName, 10*time.Millisecond, func(list []string) {
// 10ms period which set before is too short
// change 10ms to 500ms to ensure the the group checker schedule after the second value stored
gc1 := GetGroupChecker(groupName, 500*time.Millisecond, func(list []string) {
signal <- list
})
gc1.Check("1")
@ -35,7 +37,7 @@ func TestGroupChecker(t *testing.T) {
})
gc2.Check("2")
assert.Equal(t, 10*time.Millisecond, gc2.d)
assert.Equal(t, 500*time.Millisecond, gc2.d)
list := <-signal
assert.ElementsMatch(t, []string{"1", "2"}, list)