We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48892cf commit 7757bf8Copy full SHA for 7757bf8
retry_test.go
@@ -148,23 +148,19 @@ func TestRetry(t *testing.T) {
148
149
t.Run("Jitter", func(t *testing.T) {
150
t.Parallel()
151
- var count int
152
153
var durs []time.Duration
154
last := time.Now()
155
- New(time.Millisecond).Attempts(500).Jitter(0.9991).Run(func() error {
+ New(time.Millisecond * 100).Attempts(100).Jitter(0.1).Run(func() error {
156
durs = append(durs, time.Since(last))
157
last = time.Now()
158
- count++
159
return io.EOF
160
})
161
162
avg := avgDurations(durs)
163
164
- t.Logf("avg dur: %v", avg)
165
-
166
- if avg < time.Microsecond*900 || avg > time.Microsecond*1200 {
167
- t.Errorf("bad avg dur")
+ if avg < time.Millisecond*90 || avg > time.Millisecond*110 {
+ t.Error("bad avg dur", avg)
168
}
169
170
0 commit comments