Skip to content

Commit

Permalink
tests/etcdutil: reduce TestRandomKillEtcd test time
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <admin@liudos.us>
  • Loading branch information
lhy1024 committed Mar 20, 2024
1 parent bbb2470 commit dd8e53e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions pkg/utils/etcdutil/etcdutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,26 @@ func (suite *loopWatcherTestSuite) TestLoadWithLimitChange() {
re := suite.Require()
re.NoError(failpoint.Enable("github.com/tikv/pd/pkg/utils/etcdutil/meetEtcdError", `return()`))
cache := make(map[string]struct{})
for i := 0; i < int(maxLoadBatchSize)*2; i++ {
suite.put(re, fmt.Sprintf("TestLoadWithLimitChange%d", i), "")

// create data
count := int(maxLoadBatchSize) * 2
var wg sync.WaitGroup
tasks := make(chan int, count)
for w := 0; w < 16; w++ {
wg.Add(1)
go func() {
defer wg.Done()
for i := range tasks {
suite.put(re, fmt.Sprintf("TestLoadWithLimitChange%d", i), "")
}
}()
}
for i := 0; i < count; i++ {
tasks <- i
}
close(tasks)
wg.Wait()

watcher := NewLoopWatcher(
suite.ctx,
&suite.wg,
Expand Down

0 comments on commit dd8e53e

Please sign in to comment.