mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add functions/vendor files
This commit is contained in:
37
vendor/github.com/dghubble/go-twitter/twitter/backoffs_test.go
generated
vendored
Normal file
37
vendor/github.com/dghubble/go-twitter/twitter/backoffs_test.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package twitter
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewExponentialBackOff(t *testing.T) {
|
||||
b := newExponentialBackOff()
|
||||
assert.Equal(t, 5*time.Second, b.InitialInterval)
|
||||
assert.Equal(t, 2.0, b.Multiplier)
|
||||
assert.Equal(t, 320*time.Second, b.MaxInterval)
|
||||
}
|
||||
|
||||
func TestNewAggressiveExponentialBackOff(t *testing.T) {
|
||||
b := newAggressiveExponentialBackOff()
|
||||
assert.Equal(t, 1*time.Minute, b.InitialInterval)
|
||||
assert.Equal(t, 2.0, b.Multiplier)
|
||||
assert.Equal(t, 16*time.Minute, b.MaxInterval)
|
||||
}
|
||||
|
||||
// BackoffRecorder is an implementation of backoff.BackOff that records
|
||||
// calls to NextBackOff and Reset for later inspection in tests.
|
||||
type BackOffRecorder struct {
|
||||
Count int
|
||||
}
|
||||
|
||||
func (b *BackOffRecorder) NextBackOff() time.Duration {
|
||||
b.Count++
|
||||
return 1 * time.Nanosecond
|
||||
}
|
||||
|
||||
func (b *BackOffRecorder) Reset() {
|
||||
b.Count = 0
|
||||
}
|
||||
Reference in New Issue
Block a user