diff --git a/pkg/wrapper/exponentialBackoff_test.go b/pkg/wrapper/exponentialBackoff_test.go index cd63d396..b82e1387 100644 --- a/pkg/wrapper/exponentialBackoff_test.go +++ b/pkg/wrapper/exponentialBackoff_test.go @@ -4,7 +4,6 @@ import ( "context" "github.com/alaingilbert/clockwork" "github.com/magiconair/properties/assert" - "sync" "sync/atomic" "testing" "time" @@ -13,8 +12,6 @@ import ( func TestExponentialBackoff_Wait(t *testing.T) { var counter uint32 clock := clockwork.NewFakeClock() - wg := &sync.WaitGroup{} - wg.Add(1) go func() { clock.BlockUntil(1) clock.Advance(1000 * time.Millisecond) @@ -27,15 +24,11 @@ func TestExponentialBackoff_Wait(t *testing.T) { clock.BlockUntil(0) atomic.AddUint32(&counter, 1) }() - go func() { - e := NewExponentialBackoff(context.Background(), 60) - e.SetClock(clock) - e.Wait() // First time has no wait - e.Wait() // Wait 1s - e.Wait() // Wait 2s - e.Wait() // Wait 4s - wg.Done() - }() - wg.Wait() + e := NewExponentialBackoff(context.Background(), 60) + e.SetClock(clock) + e.Wait() // First time has no wait + e.Wait() // Wait 1s + e.Wait() // Wait 2s + e.Wait() // Wait 4s assert.Equal(t, uint32(1), atomic.LoadUint32(&counter)) }