@@ -12,6 +12,7 @@ import (
1212)
1313
1414func TestNewConstantBackoff (t * testing.T ) {
15+ t .Parallel ()
1516 r := require .New (t )
1617 expectedSleepDuration := 10 * time .Second
1718 backoff := NewConstantBackoff (expectedSleepDuration )
@@ -22,6 +23,7 @@ func TestNewConstantBackoff(t *testing.T) {
2223}
2324
2425func TestDefaultExponentialBackoff (t * testing.T ) {
26+ t .Parallel ()
2527 r := require .New (t )
2628
2729 val := DefaultExponentialBackoff ()
@@ -33,10 +35,13 @@ func TestDefaultExponentialBackoff(t *testing.T) {
3335}
3436
3537func TestRetry (t * testing.T ) {
38+ t .Parallel ()
3639 r := require .New (t )
3740
3841 t .Run ("Retrying logic tests" , func (t * testing.T ) {
42+ t .Parallel ()
3943 t .Run ("Called at least once, even if retries or steps is 0" , func (t * testing.T ) {
44+ t .Parallel ()
4045 called := false
4146 err := Retry (context .Background (), wait.Backoff {Steps : 0 }, 0 , func (_ context.Context ) (bool , error ) {
4247 called = true
@@ -48,6 +53,7 @@ func TestRetry(t *testing.T) {
4853 })
4954
5055 t .Run ("Respects backoff and retry count" , func (t * testing.T ) {
56+ t .Parallel ()
5157 retries := 4
5258 expectedTotalExecutions := 1 + retries
5359 backoff := DefaultExponentialBackoff ()
@@ -88,6 +94,7 @@ func TestRetry(t *testing.T) {
8894 })
8995
9096 t .Run ("Returns last encountered error" , func (t * testing.T ) {
97+ t .Parallel ()
9198 timesCalled := 0
9299 expectedErrMessage := "boom 3"
93100
@@ -101,6 +108,7 @@ func TestRetry(t *testing.T) {
101108 })
102109
103110 t .Run ("Does not retry if false is returned as first parameter" , func (t * testing.T ) {
111+ t .Parallel ()
104112 expectedErr := errors .New ("dummy" )
105113 called := false
106114 err := Retry (context .Background (), NewConstantBackoff (10 * time .Millisecond ), 10 ,
@@ -115,7 +123,9 @@ func TestRetry(t *testing.T) {
115123 })
116124
117125 t .Run ("Notify callback tests" , func (t * testing.T ) {
126+ t .Parallel ()
118127 t .Run ("Notify is passed and called" , func (t * testing.T ) {
128+ t .Parallel ()
119129 err := Retry (
120130 context .Background (),
121131 NewConstantBackoff (10 * time .Millisecond ),
@@ -131,6 +141,7 @@ func TestRetry(t *testing.T) {
131141 })
132142
133143 t .Run ("Notify is not passed, no panic" , func (t * testing.T ) {
144+ t .Parallel ()
134145 err := Retry (
135146 context .Background (),
136147 NewConstantBackoff (10 * time .Millisecond ),
@@ -145,7 +156,9 @@ func TestRetry(t *testing.T) {
145156 })
146157
147158 t .Run ("Context tests" , func (t * testing.T ) {
159+ t .Parallel ()
148160 t .Run ("On context cancel, stops" , func (t * testing.T ) {
161+ t .Parallel ()
149162 ctx , cancel := context .WithCancelCause (context .Background ())
150163
151164 innerError := errors .New ("from operation" )
@@ -168,6 +181,7 @@ func TestRetry(t *testing.T) {
168181 })
169182
170183 t .Run ("Operation is called at least once, even if context is cancelled" , func (t * testing.T ) {
184+ t .Parallel ()
171185 ctx , cancel := context .WithCancel (context .Background ())
172186 cancel ()
173187
0 commit comments