feat: specify running cycles for load testing.

This commit is contained in:
徐聪
2022-01-12 14:51:53 +08:00
parent 7a15df3177
commit 1d04b2c22d
6 changed files with 12 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package boomer
import (
"sync/atomic"
"testing"
"time"
@@ -109,7 +110,7 @@ func TestLoopCount(t *testing.T) {
ticker := time.NewTicker(4 * time.Second)
defer ticker.Stop()
<-ticker.C
if !assert.Equal(t, runner.loop.loopCount, runner.loop.finishedCount) {
if !assert.Equal(t, runner.loop.loopCount, atomic.LoadInt64(&runner.loop.finishedCount)) {
t.Fail()
}
}