Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Aug 14, 2020
1 parent a3d7474 commit e7dd047
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/executors/periodicalexecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ func TestPeriodicalExecutor_Bulk(t *testing.T) {
lock.Unlock()
}

func TestPeriodicalExecutor_Wait(t *testing.T) {
var lock sync.Mutex
executer := NewBulkExecutor(func(tasks []interface{}) {
lock.Lock()
defer lock.Unlock()
time.Sleep(10 * time.Millisecond)
}, WithBulkTasks(1), WithBulkInterval(time.Second))
for i := 0; i < 10; i++ {
executer.Add(1)
}
executer.Flush()
executer.Wait()
}

// go test -benchtime 10s -bench .
func BenchmarkExecutor(b *testing.B) {
b.ReportAllocs()
Expand Down

0 comments on commit e7dd047

Please sign in to comment.