redis/internal/internal_test.go

19 lines
330 B
Go
Raw Permalink Normal View History

2017-05-25 08:08:44 +03:00
package internal
import (
"testing"
"time"
2017-07-09 13:10:07 +03:00
2023-01-27 18:00:49 +03:00
. "github.com/bsm/gomega"
2017-05-25 08:08:44 +03:00
)
func TestRetryBackoff(t *testing.T) {
RegisterTestingT(t)
2017-07-09 13:10:07 +03:00
2020-07-28 16:26:03 +03:00
for i := 0; i <= 16; i++ {
2017-07-09 13:10:07 +03:00
backoff := RetryBackoff(i, time.Millisecond, 512*time.Millisecond)
2017-05-25 08:08:44 +03:00
Expect(backoff >= 0).To(BeTrue())
Expect(backoff <= 512*time.Millisecond).To(BeTrue())
}
}