github.com/webonyx/up@v0.7.4-0.20180808230834-91b94e551323/config/backoff_test.go (about) 1 package config 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/tj/assert" 8 ) 9 10 func TestBackoff_Default(t *testing.T) { 11 a := &Backoff{} 12 assert.NoError(t, a.Default(), "default") 13 14 b := &Backoff{ 15 Min: 100, 16 Max: 500, 17 Factor: 2, 18 Attempts: 3, 19 } 20 21 assert.Equal(t, b, a) 22 } 23 24 func TestBackoff_Backoff(t *testing.T) { 25 a := &Backoff{} 26 assert.NoError(t, a.Default(), "default") 27 28 b := a.Backoff() 29 assert.Equal(t, time.Millisecond*100, b.Min) 30 assert.Equal(t, time.Millisecond*500, b.Max) 31 }