diff --git a/Race_test.go b/Race_test.go index 9b9ba70..01c660b 100644 --- a/Race_test.go +++ b/Race_test.go @@ -19,7 +19,7 @@ import ( ) func TestRace(t *testing.T) { - eventually := assert.Eventually{RetryStrategy: assert.Waiter{Timeout: time.Second}} + eventually := assert.Retry{Strategy: assert.Waiter{Timeout: time.Second}} t.Run(`functions run in race against each other`, func(t *testing.T) { eventually.Assert(t, func(it assert.It) { diff --git a/Spec.go b/Spec.go index bda5f0d..26a8f27 100644 --- a/Spec.go +++ b/Spec.go @@ -90,8 +90,8 @@ type Spec struct { parallel bool sequential bool skipBenchmark bool - flaky *assert.Eventually - eventually *assert.Eventually + flaky *assert.Retry + eventually *assert.Retry group *struct{ name string } description string tags []string @@ -290,24 +290,24 @@ func (spec *Spec) isBenchAllowedToRun() bool { return true } -func (spec *Spec) lookupRetryFlaky() (assert.Eventually, bool) { +func (spec *Spec) lookupRetryFlaky() (assert.Retry, bool) { spec.testingTB.Helper() for _, context := range spec.specsFromParent() { if context.flaky != nil { return *context.flaky, true } } - return assert.Eventually{}, false + return assert.Retry{}, false } -func (spec *Spec) lookupRetryEventually() (assert.Eventually, bool) { +func (spec *Spec) lookupRetryEventually() (assert.Retry, bool) { spec.testingTB.Helper() for _, context := range spec.specsFromParent() { if context.eventually != nil { return *context.eventually, true } } - return assert.Eventually{}, false + return assert.Retry{}, false } func (spec *Spec) printDescription(tb testing.TB) { diff --git a/Spec_test.go b/Spec_test.go index 793f9dd..a3dfad7 100644 --- a/Spec_test.go +++ b/Spec_test.go @@ -1047,8 +1047,8 @@ func TestSpec_Test_flakyByRetry_willRunAgainWithTheProvidedRetry(t *testing.T) { s := testcase.NewSpec(t) var retryUsed bool - retry := assert.Eventually{ - RetryStrategy: assert.RetryStrategyFunc(func(condition func() bool) { + retry := assert.Retry{ + Strategy: assert.RetryStrategyFunc(func(condition func() bool) { retryUsed = true for condition() { } @@ -1158,7 +1158,7 @@ func TestSpec_Parallel_testPrepareActionsExecutedInParallel(t *testing.T) { } func TestSpec_Context_nonParallelTestExecutionOrder_isRandom(t *testing.T) { - assert.Eventually{RetryStrategy: assert.Waiter{WaitDuration: time.Second}}.Assert(t, func(it assert.It) { + assert.Retry{Strategy: assert.Waiter{WaitDuration: time.Second}}.Assert(t, func(it assert.It) { var m sync.Mutex out := make([]int, 0) testcase.NewSpec(it).Context("", func(s *testcase.Spec) { diff --git a/T.go b/T.go index acf19d3..f3d8e0c 100644 --- a/T.go +++ b/T.go @@ -154,7 +154,7 @@ func (t *T) hasOnLetHookApplied(name string) bool { return false } -var DefaultEventually = assert.Eventually{RetryStrategy: assert.Waiter{Timeout: 3 * time.Second}} +var DefaultEventually = assert.Retry{Strategy: assert.Waiter{Timeout: 3 * time.Second}} // Eventually helper allows you to write expectations to results that will only be eventually true. // A common scenario where using Eventually will benefit you is testing concurrent operations. diff --git a/T_test.go b/T_test.go index c7f5228..fba50ee 100644 --- a/T_test.go +++ b/T_test.go @@ -343,7 +343,7 @@ func TestT_HasTag(t *testing.T) { func TestT_Random(t *testing.T) { randomGenerationWorks := func(t *testcase.T) { - assert.Eventually{RetryStrategy: assert.Waiter{WaitDuration: time.Second}}.Assert(t, func(it assert.It) { + assert.Retry{Strategy: assert.Waiter{WaitDuration: time.Second}}.Assert(t, func(it assert.It) { it.Must.True(0 < t.Random.Int()) }) } diff --git a/assert/Asserter.go b/assert/Asserter.go index a5bcd27..8540689 100644 --- a/assert/Asserter.go +++ b/assert/Asserter.go @@ -1049,3 +1049,17 @@ func (a Asserter) within(timeout time.Duration, blk func(context.Context)) bool } return atomic.LoadUint32(&done) == 1 } + +func (a Asserter) Eventually(durationOrCount any, blk func(it It)) { + a.TB.Helper() + var retry Retry + switch v := durationOrCount.(type) { + case time.Duration: + retry = Retry{Strategy: Waiter{Timeout: v}} + case int: + retry = Retry{Strategy: RetryCount(v)} + default: + a.TB.Fatalf("%T is neither a duration or the number of times to retry", durationOrCount) + } + retry.Assert(a.TB, blk) +} diff --git a/assert/Asserter_test.go b/assert/Asserter_test.go index a801bfb..96b01b4 100644 --- a/assert/Asserter_test.go +++ b/assert/Asserter_test.go @@ -1232,7 +1232,7 @@ func TestAsserter_Within(t *testing.T) { }) assert.True(t, dtb.IsFailed) - assert.EventuallyWithin(3*time.Second).Assert(t, func(it assert.It) { + assert.MakeRetry(3*time.Second).Assert(t, func(it assert.It) { it.Must.True(atomic.LoadInt32(&isCancelled) == 1) }) }) @@ -1292,7 +1292,7 @@ func TestAsserter_NotWithin(t *testing.T) { }) assert.False(t, dtb.IsFailed) - assert.EventuallyWithin(3*time.Second).Assert(t, func(it assert.It) { + assert.MakeRetry(3*time.Second).Assert(t, func(it assert.It) { it.Must.True(atomic.LoadInt32(&isCancelled) == 1) }) }) @@ -1965,3 +1965,68 @@ func TestRegisterEqual(t *testing.T) { }) assert.False(t, dtb.IsFailed) } + +func TestAsserter_Eventually(t *testing.T) { + t.Run("happy - n times", func(t *testing.T) { + dtb := &doubles.TB{} + var ran int + sandbox.Run(func() { + subject := asserter(dtb) + var ok bool + subject.Eventually(2, func(it assert.It) { + ran++ + if ok { + return // OK + } + ok = true + it.FailNow() + }) + }) + + assert.False(t, dtb.IsFailed, "eventually pass") + }) + t.Run("happy - n time duration", func(t *testing.T) { + dtb := &doubles.TB{} + sandbox.Run(func() { + subject := asserter(dtb) + tries := 128 + subject.Eventually(time.Minute, func(it assert.It) { + tries-- + if tries <= 0 { + return // OK + } + it.FailNow() + }) + }) + assert.False(t, dtb.IsFailed, "eventually pass") + }) + t.Run("rainy - n times", func(t *testing.T) { + dtb := &doubles.TB{} + var tried int + sandbox.Run(func() { + subject := asserter(dtb) + subject.Eventually(2, func(it assert.It) { + tried++ + it.FailNow() + }) + }) + assert.True(t, dtb.IsFailed, "eventually fail") + assert.NotEqual(t, tried, 0) + }) + t.Run("rainy - n duration", func(t *testing.T) { + dtb := &doubles.TB{} + sandbox.Run(func() { + subject := asserter(dtb) + var ok bool + subject.Eventually(100*time.Millisecond, func(it assert.It) { + if ok { + return // OK which will never happen + } + ok = true + time.Sleep(150 * time.Millisecond) + it.FailNow() + }) + }) + assert.True(t, dtb.IsFailed, "eventually fail") + }) +} diff --git a/assert/Eventually.go b/assert/Eventually.go index 8078691..e13f28b 100644 --- a/assert/Eventually.go +++ b/assert/Eventually.go @@ -9,24 +9,24 @@ import ( "go.llib.dev/testcase/internal/doubles" ) -func EventuallyWithin[T time.Duration | int](durationOrCount T) Eventually { +func MakeRetry[T time.Duration | int](durationOrCount T) Retry { switch v := any(durationOrCount).(type) { case time.Duration: - return Eventually{RetryStrategy: Waiter{Timeout: v}} + return Retry{Strategy: Waiter{Timeout: v}} case int: - return Eventually{RetryStrategy: RetryCount(v)} + return Retry{Strategy: RetryCount(v)} default: - panic("invalid usage") + panic("impossible usage") } } -// Eventually Automatically retries operations whose failure is expected under certain defined conditions. +// Retry Automatically retries operations whose failure is expected under certain defined conditions. // This pattern enables fault-tolerance. // -// A common scenario where using Eventually will benefit you is testing concurrent operations. +// A common scenario where using Retry will benefit you is testing concurrent operations. // Due to the nature of async operations, one might need to wait // and observe the system with multiple tries before the outcome can be seen. -type Eventually struct{ RetryStrategy RetryStrategy } +type Retry struct{ Strategy RetryStrategy } type RetryStrategy interface { // While implements the retry strategy looping part. @@ -43,12 +43,12 @@ func (fn RetryStrategyFunc) While(condition func() bool) { fn(condition) } // In case expectations are failed, it will retry the assertion block using the RetryStrategy. // The last failed assertion results would be published to the received testing.TB. // Calling multiple times the assertion function block content should be a safe and repeatable operation. -func (r Eventually) Assert(tb testing.TB, blk func(it It)) { +func (r Retry) Assert(tb testing.TB, blk func(it It)) { tb.Helper() var lastRecorder *doubles.RecorderTB isFailed := tb.Failed() - r.RetryStrategy.While(func() bool { + r.Strategy.While(func() bool { tb.Helper() lastRecorder = &doubles.RecorderTB{TB: tb} ro := sandbox.Run(func() { diff --git a/assert/Eventually_test.go b/assert/Eventually_test.go index ece2739..4bc2467 100644 --- a/assert/Eventually_test.go +++ b/assert/Eventually_test.go @@ -14,15 +14,15 @@ import ( "go.llib.dev/testcase" ) -func TestEventually(t *testing.T) { - SpecEventually(t) +func TestRetry(t *testing.T) { + SpecRetry(t) } func BenchmarkEventually(b *testing.B) { - SpecEventually(b) + SpecRetry(b) } -func SpecEventually(tb testing.TB) { +func SpecRetry(tb testing.TB) { s := testcase.NewSpec(tb) var ( @@ -30,9 +30,9 @@ func SpecEventually(tb testing.TB) { strategyStub = testcase.Let(s, func(t *testcase.T) *stubRetryStrategy { return &stubRetryStrategy{ShouldRetry: strategyWillRetry.Get(t)} }) - helper = testcase.Let(s, func(t *testcase.T) *assert.Eventually { - return &assert.Eventually{ - RetryStrategy: strategyStub.Get(t), + helper = testcase.Let(s, func(t *testcase.T) *assert.Retry { + return &assert.Retry{ + Strategy: strategyStub.Get(t), } }) ) @@ -353,8 +353,8 @@ func SpecEventually(tb testing.TB) { } func TestRetry_Assert_failsOnceButThenPass(t *testing.T) { - w := assert.Eventually{ - RetryStrategy: assert.Waiter{ + w := assert.Retry{ + Strategy: assert.Waiter{ WaitDuration: 0, Timeout: 42 * time.Second, }, @@ -388,8 +388,8 @@ func TestRetry_Assert_failsOnceButThenPass(t *testing.T) { func TestRetry_Assert_panic(t *testing.T) { rnd := random.New(random.CryptoSeed{}) - w := assert.Eventually{ - RetryStrategy: assert.RetryStrategyFunc(func(condition func() bool) { + w := assert.Retry{ + Strategy: assert.RetryStrategyFunc(func(condition func() bool) { for condition() { } }), @@ -488,11 +488,11 @@ func TestRetryCount_While(t *testing.T) { }) } -func TestEventuallyWithin(t *testing.T) { +func TestMakeRetry(t *testing.T) { t.Run("time.Duration", func(t *testing.T) { t.Run("on timeout", func(t *testing.T) { it := assert.MakeIt(t) - e := assert.EventuallyWithin(time.Millisecond) + e := assert.MakeRetry(time.Millisecond) dtb := &doubles.TB{} t1 := time.Now() @@ -506,7 +506,7 @@ func TestEventuallyWithin(t *testing.T) { }) t.Run("within the time", func(t *testing.T) { it := assert.MakeIt(t) - e := assert.EventuallyWithin(time.Millisecond) + e := assert.MakeRetry(time.Millisecond) dtb := &doubles.TB{} t1 := time.Now() @@ -522,7 +522,7 @@ func TestEventuallyWithin(t *testing.T) { t.Run("retry count", func(t *testing.T) { t.Run("out of count", func(t *testing.T) { it := assert.MakeIt(t) - e := assert.EventuallyWithin(3) + e := assert.MakeRetry(3) dtb := &doubles.TB{} e.Assert(dtb, func(it assert.It) { @@ -534,7 +534,7 @@ func TestEventuallyWithin(t *testing.T) { t.Run("within the count", func(t *testing.T) { it := assert.MakeIt(t) - e := assert.EventuallyWithin(3) + e := assert.MakeRetry(3) dtb := &doubles.TB{} n := 3 diff --git a/assert/example_test.go b/assert/example_test.go index 0bbfbc5..18ba0f7 100644 --- a/assert/example_test.go +++ b/assert/example_test.go @@ -202,10 +202,10 @@ func ExampleAnyOf_structWithManyAcceptableState() { type ExamplePublisherEvent struct{ V int } type ExamplePublisher struct{} -func (ExamplePublisher) Publish(event ExamplePublisherEvent) {} -func (ExamplePublisher) Subscribe(func(event ExamplePublisherEvent)) {} -func (ExamplePublisher) Wait() {} -func (ExamplePublisher) Close() error { return nil } +func (ExamplePublisher) Publish(ExamplePublisherEvent) {} +func (ExamplePublisher) Subscribe(func(ExamplePublisherEvent)) {} +func (ExamplePublisher) Wait() {} +func (ExamplePublisher) Close() error { return nil } func ExampleAnyOf_fanOutPublishing() { var tb testing.TB @@ -459,36 +459,36 @@ func ExampleWaiter_While() { }) } -func ExampleEventuallyWithin() { +func ExampleMakeRetry() { var tb testing.TB - assert.EventuallyWithin(5*time.Second).Assert(tb, func(it assert.It) { + assert.MakeRetry(5*time.Second).Assert(tb, func(it assert.It) { // use "it" as you would tb, but if the test fails with "it" // then the function block will be retried until the allowed time duration, which is one minute in this case. }) } -func ExampleEventuallyWithin_byCount() { +func ExampleMakeRetry_byCount() { var tb testing.TB - assert.EventuallyWithin(3 /* times */).Assert(tb, func(it assert.It) { + assert.MakeRetry(3 /* times */).Assert(tb, func(it assert.It) { // use "it" as you would tb, but if the test fails with "it" // it will be retried 3 times as specified above as argument. }) } -func ExampleEventuallyWithin_byTimeout() { +func ExampleMakeRetry_byTimeout() { var tb testing.TB - assert.EventuallyWithin(time.Minute /* times */).Assert(tb, func(it assert.It) { + assert.MakeRetry(time.Minute /* times */).Assert(tb, func(it assert.It) { // use "it" as you would tb, but if the test fails with "it" // then the function block will be retried until the allowed time duration, which is one minute in this case. }) } -func ExampleEventually() { +func ExampleRetry() { waiter := assert.Waiter{ WaitDuration: time.Millisecond, Timeout: time.Second, } - w := assert.Eventually{RetryStrategy: waiter} + w := assert.Retry{Strategy: waiter} var t *testing.T // will attempt to wait until assertion block passes without a failing testCase result. @@ -503,7 +503,7 @@ func ExampleEventually() { }) } -func ExampleEventually_asContextOption() { +func ExampleRetry_asContextOption() { var tb testing.TB s := testcase.NewSpec(tb) @@ -512,12 +512,12 @@ func ExampleEventually_asContextOption() { }, testcase.Flaky(assert.RetryCount(42))) } -func ExampleEventually_count() { - _ = assert.Eventually{RetryStrategy: assert.RetryCount(42)} +func ExampleRetry_count() { + _ = assert.Retry{Strategy: assert.RetryCount(42)} } -func ExampleEventually_byTimeout() { - r := assert.Eventually{RetryStrategy: assert.Waiter{ +func ExampleRetry_byTimeout() { + r := assert.Retry{Strategy: assert.Waiter{ WaitDuration: time.Millisecond, Timeout: time.Second, }} @@ -530,8 +530,8 @@ func ExampleEventually_byTimeout() { }) } -func ExampleEventually_byCount() { - r := assert.Eventually{RetryStrategy: assert.RetryCount(42)} +func ExampleRetry_byCount() { + r := assert.Retry{Strategy: assert.RetryCount(42)} var t *testing.T r.Assert(t, func(it assert.It) { @@ -541,7 +541,7 @@ func ExampleEventually_byCount() { }) } -func ExampleEventually_byCustomRetryStrategy() { +func ExampleRetry_byCustomRetryStrategy() { // this approach ideal if you need to deal with asynchronous systems // where you know that if a workflow process ended already, // there is no point in retrying anymore the assertion. @@ -554,7 +554,7 @@ func ExampleEventually_byCustomRetryStrategy() { } } - r := assert.Eventually{RetryStrategy: assert.RetryStrategyFunc(while)} + r := assert.Retry{Strategy: assert.RetryStrategyFunc(while)} var t *testing.T r.Assert(t, func(it assert.It) { @@ -713,3 +713,17 @@ func ExampleAsserter_NotMatch() { assert.Must(tb).NotMatch("42", "^[a-z]+") assert.Must(tb).NotMatch("forty-two", "^[0-9]+") } + +func ExampleAsserter_Eventually() { + var tb testing.TB + assert.Must(tb).Eventually(time.Minute, func(it assert.It) { + it.Must.True(rand.Intn(1) == 0) + }) +} + +func ExampleEventually() { + var tb testing.TB + assert.Eventually(tb, time.Second, func(it assert.It) { + it.Must.True(rand.Intn(1) == 0) + }) +} diff --git a/assert/pkgfunc.go b/assert/pkgfunc.go index 8e30420..2ac31f0 100644 --- a/assert/pkgfunc.go +++ b/assert/pkgfunc.go @@ -121,3 +121,8 @@ func NotMatch[T string | []byte](tb testing.TB, v T, expr string, msg ...Message tb.Helper() Must(tb).NotMatch(string(v), expr, msg...) } + +func Eventually[T time.Duration | int](tb testing.TB, durationOrCount T, blk func(it It)) { + tb.Helper() + Must(tb).Eventually(durationOrCount, blk) +} diff --git a/assert/pkgfunc_test.go b/assert/pkgfunc_test.go index df072e7..cdc9a3b 100644 --- a/assert/pkgfunc_test.go +++ b/assert/pkgfunc_test.go @@ -403,6 +403,30 @@ func TestPublicFunctions(t *testing.T) { assert.NotMatch(tb, "forty-two", "[0-9") }, }, + // .Eventually + { + Desc: ".Eventually - happy", + Failed: false, + Assert: func(tb testing.TB) { + var ok bool + assert.Eventually(tb, 2, func(it assert.It) { + if ok { + return + } + ok = true + it.FailNow() + }) + }, + }, + { + Desc: ".Eventually - rainy value", + Failed: true, + Assert: func(tb testing.TB) { + assert.Eventually(tb, 1, func(it assert.It) { + it.FailNow() + }) + }, + }, } { t.Run(tc.Desc, func(t *testing.T) { stub := &doubles.TB{} diff --git a/backward.go b/backward.go index a8292a1..c9ad454 100644 --- a/backward.go +++ b/backward.go @@ -5,8 +5,8 @@ import "go.llib.dev/testcase/assert" type ( // Eventually // - // DEPRECATED: use assert.Eventually instead - Eventually = assert.Eventually + // DEPRECATED: use assert.Retry instead + Eventually = assert.Retry // RetryStrategy // // DEPRECATED: use assert.RetryStrategy instead diff --git a/clock/timecop/timecop_test.go b/clock/timecop/timecop_test.go index 0901cf6..5d059ad 100644 --- a/clock/timecop/timecop_test.go +++ b/clock/timecop/timecop_test.go @@ -141,7 +141,7 @@ func TestTravel_timeTime(t *testing.T) { assert.Waiter{WaitDuration: time.Second}.Wait() assert.True(t, date.Equal(clock.TimeNow())) timecop.Travel(t, clock.TimeNow(), timecop.Unfreeze()) - assert.EventuallyWithin(time.Second).Assert(t, func(it assert.It) { + assert.MakeRetry(time.Second).Assert(t, func(it assert.It) { it.Must.False(date.Equal(clock.TimeNow())) }) }) diff --git a/examples_test.go b/examples_test.go index 71682f7..5fa5be1 100644 --- a/examples_test.go +++ b/examples_test.go @@ -1134,7 +1134,7 @@ func Example_assertEventually() { WaitDuration: time.Millisecond, Timeout: time.Second, } - w := assert.Eventually{RetryStrategy: waiter} + w := assert.Retry{Strategy: waiter} var t *testing.T // will attempt to wait until assertion block passes without a failing testCase result. @@ -1159,11 +1159,11 @@ func Example_assertEventuallyAsContextOption() { } func Example_assertEventuallyCount() { - _ = assert.Eventually{RetryStrategy: assert.RetryCount(42)} + _ = assert.Retry{Strategy: assert.RetryCount(42)} } func Example_assertEventuallyByTimeout() { - r := assert.Eventually{RetryStrategy: assert.Waiter{ + r := assert.Retry{Strategy: assert.Waiter{ WaitDuration: time.Millisecond, Timeout: time.Second, }} @@ -1177,7 +1177,7 @@ func Example_assertEventuallyByTimeout() { } func Example_assertEventuallyByCount() { - r := assert.Eventually{RetryStrategy: assert.RetryCount(42)} + r := assert.Retry{Strategy: assert.RetryCount(42)} var t *testing.T r.Assert(t, func(it assert.It) { @@ -1200,7 +1200,7 @@ func Example_assertEventuallyByCustomRetryStrategy() { } } - r := assert.Eventually{RetryStrategy: assert.RetryStrategyFunc(while)} + r := assert.Retry{Strategy: assert.RetryStrategyFunc(while)} var t *testing.T r.Assert(t, func(it assert.It) { diff --git a/opts.go b/opts.go index f03689f..590c507 100644 --- a/opts.go +++ b/opts.go @@ -41,24 +41,24 @@ func Flaky(CountOrTimeout interface{}) SpecOption { }) } -func makeEventually(i any) (assert.Eventually, bool) { +func makeEventually(i any) (assert.Retry, bool) { switch n := i.(type) { case time.Duration: - return assert.Eventually{RetryStrategy: assert.Waiter{Timeout: n}}, true + return assert.Retry{Strategy: assert.Waiter{Timeout: n}}, true case int: - return assert.Eventually{RetryStrategy: assert.RetryCount(n)}, true + return assert.Retry{Strategy: assert.RetryCount(n)}, true case assert.RetryStrategy: - return assert.Eventually{RetryStrategy: n}, true - case assert.Eventually: + return assert.Retry{Strategy: n}, true + case assert.Retry: return n, true default: - return assert.Eventually{}, false + return assert.Retry{}, false } } func RetryStrategyForEventually(strategy assert.RetryStrategy) SpecOption { return specOptionFunc(func(s *Spec) { - s.eventually = &assert.Eventually{RetryStrategy: strategy} + s.eventually = &assert.Retry{Strategy: strategy} }) } diff --git a/ordering_test.go b/ordering_test.go index 9afa53f..9209d6d 100644 --- a/ordering_test.go +++ b/ordering_test.go @@ -130,7 +130,7 @@ func TestRandomOrderer_Order(t *testing.T) { }) s.Then(`different seed yield different shuffling`, func(t *T) { - assert.Eventually{RetryStrategy: assert.Waiter{Timeout: time.Second}}.Assert(t, func(it assert.It) { + assert.Retry{Strategy: assert.Waiter{Timeout: time.Second}}.Assert(t, func(it assert.It) { out := &[]int{} ogIn := genOrdInput(out) initial := runOrdInput(ogIn, out) diff --git a/random/Factory_test.go b/random/Factory_test.go index 971db92..9fec15c 100644 --- a/random/Factory_test.go +++ b/random/Factory_test.go @@ -27,7 +27,7 @@ func TestFactory(t *testing.T) { return factory.Get(t).Make(rnd.Get(t), T.Get(t)) } - retry := assert.Eventually{RetryStrategy: assert.Waiter{ + retry := assert.Retry{Strategy: assert.Waiter{ Timeout: 5 * time.Second, }} diff --git a/random/Make_test.go b/random/Make_test.go index b82cf7d..1771ae6 100644 --- a/random/Make_test.go +++ b/random/Make_test.go @@ -285,7 +285,7 @@ func TestRandom_Make(t *testing.T) { func TestSlice_smoke(t *testing.T) { it := assert.MakeIt(t) - eventually := assert.EventuallyWithin(5 * time.Second) + eventually := assert.MakeRetry(5 * time.Second) rnd := random.New(random.CryptoSeed{}) length := rnd.IntB(1, 5) slice1 := random.Slice[int](length, rnd.Int) @@ -307,7 +307,7 @@ func TestSlice_smoke(t *testing.T) { func TestMap_smoke(t *testing.T) { it := assert.MakeIt(t) - eventually := assert.EventuallyWithin(5 * time.Second) + eventually := assert.MakeRetry(5 * time.Second) rnd := random.New(random.CryptoSeed{}) length := rnd.IntB(1, 5) map1 := random.Map[string, int](length, func() (string, int) {