@@ -14,7 +14,7 @@ import (
1414 "testing"
1515 "time"
1616
17- "github.com/avast/retry-go/v4"
17+ retrygo "github.com/avast/retry-go/v4"
1818 "github.com/pact-foundation/pact-go/dsl"
1919 "github.com/pact-foundation/pact-go/types"
2020 "github.com/pact-foundation/pact-go/utils"
@@ -42,11 +42,11 @@ var (
4242 pactServers = make (map [string ]* MockServer )
4343)
4444
45- func defaultRetryOptions () []retry .Option {
46- return []retry .Option {
47- retry .Attempts (150000 ),
48- retry .Delay (200 * time .Millisecond ),
49- retry .DelayType (retry .FixedDelay ),
45+ func defaultRetryOptions () []retrygo .Option {
46+ return []retrygo .Option {
47+ retrygo .Attempts (150000 ),
48+ retrygo .Delay (200 * time .Millisecond ),
49+ retrygo .DelayType (retrygo .FixedDelay ),
5050 }
5151}
5252
@@ -280,7 +280,7 @@ func AddPactInteraction(provider, consumer string, interaction *dsl.Interaction)
280280 return pactServers [key ].AddInteraction (interaction )
281281}
282282
283- func VerifyInteractions (provider , consumer string , retryOptions ... retry .Option ) error {
283+ func VerifyInteractions (provider , consumer string , retryOptions ... retrygo .Option ) error {
284284 verify := func () error {
285285 key := provider + consumer
286286 err := pactServers [key ].Verify ()
@@ -298,7 +298,7 @@ func VerifyInteractions(provider, consumer string, retryOptions ...retry.Option)
298298 retryOptions = defaultRetryOptions ()
299299 }
300300 cwd , _ := os .Getwd ()
301- if err := retry .Do (verify , retryOptions ... ); err != nil {
301+ if err := retrygo .Do (verify , retryOptions ... ); err != nil {
302302 return fmt .Errorf ("pact interactions not matched - for details see %s/pact/logs/pact-%s.log" , cwd , provider )
303303 }
304304 return nil
@@ -372,13 +372,13 @@ func EnsurePactRunning(provider, consumer string) string {
372372 Consumer : consumer ,
373373 Provider : provider ,
374374 }
375- err = retry .Do (func () error {
375+ err = retrygo .Do (func () error {
376376 err := mockServer .call ("GET" , serverAddress , nil )
377377 if err != nil && cmd .ProcessState != nil {
378- return fmt .Errorf ("calling mock server: %w" , retry .Unrecoverable (err ))
378+ return fmt .Errorf ("calling mock server: %w" , retrygo .Unrecoverable (err ))
379379 }
380380 return err
381- }, retry .DelayType (retry .FixedDelay ), retry .Delay (100 * time .Millisecond ), retry .Attempts (100 ))
381+ }, retrygo .DelayType (retrygo .FixedDelay ), retrygo .Delay (100 * time .Millisecond ), retrygo .Attempts (100 ))
382382 if err != nil {
383383 log .
384384 WithError (err ).
@@ -399,7 +399,7 @@ func EnsurePactRunning(provider, consumer string) string {
399399
400400// Runs mock services defined by the given pacts,
401401// invokes testFunc then verifies that the pacts have been invoked successfully
402- func RunIntegrationTest (t * testing.T , pactFilePaths []Pact , testFunc func (), retryOptions ... retry .Option ) error {
402+ func RunIntegrationTest (t * testing.T , pactFilePaths []Pact , testFunc func (), retryOptions ... retrygo .Option ) error {
403403 t .Helper ()
404404 return TestWithStubServices (pactFilePaths , func () {
405405 testFunc ()
@@ -411,7 +411,7 @@ func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), ret
411411 retryOptions = defaultRetryOptions ()
412412 }
413413 verify := func () error { return checkVerificationStatus (pactFilePaths ) }
414- if err := retry .Do (verify , retryOptions ... ); err != nil {
414+ if err := retrygo .Do (verify , retryOptions ... ); err != nil {
415415 log .Error ("Pact verification failed!!" +
416416 "For more info on the error check the logs/pact*.log files, they are quite detailed" )
417417 t .Errorf (err .Error ())
@@ -421,7 +421,7 @@ func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), ret
421421
422422// Runs mock services defined by the given pacts,
423423// invokes testFunc then verifies that the pacts have been invoked successfully
424- func IntegrationTest (pactFilePaths []Pact , testFunc func (), retryOptions ... retry .Option ) error {
424+ func IntegrationTest (pactFilePaths []Pact , testFunc func (), retryOptions ... retrygo .Option ) error {
425425 return TestWithStubServices (pactFilePaths , func () {
426426 testFunc ()
427427
@@ -432,7 +432,7 @@ func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retr
432432 retryOptions = defaultRetryOptions ()
433433 }
434434 verify := func () error { return checkVerificationStatus (pactFilePaths ) }
435- if err := retry .Do (verify , retryOptions ... ); err != nil {
435+ if err := retrygo .Do (verify , retryOptions ... ); err != nil {
436436 log .Fatalf ("Pact verification failed!!" +
437437 "For more info on the error check the logs/pact*.log files, they are quite detailed" )
438438 }
0 commit comments