Skip to content

Commit 7c0c5f4

Browse files
chore: revert false-positive lint fix
1 parent 3289b70 commit 7c0c5f4

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

pacttesting/mock_service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"syscall"
1313
"time"
1414

15-
retrygo "github.com/avast/retry-go/v4"
15+
"github.com/avast/retry-go/v4"
1616
log "github.com/sirupsen/logrus"
1717
)
1818

@@ -120,14 +120,14 @@ func (m *MockServer) Stop() error {
120120

121121
// wait for process to exit after interrupt, if it fails to stop
122122
// then kill it
123-
if err := retrygo.Do(func() error {
123+
if err := retry.Do(func() error {
124124
// check if the process is still alive
125125
err := p.Signal(syscall.Signal(0))
126126
if err == nil {
127127
return errors.New("server process is still alive")
128128
}
129129
return nil
130-
}, retrygo.Attempts(stopRetryAttempts), retrygo.Delay(stopRetryDelay), retrygo.DelayType(retrygo.FixedDelay)); err != nil {
130+
}, retry.Attempts(stopRetryAttempts), retry.Delay(stopRetryDelay), retry.DelayType(retry.FixedDelay)); err != nil {
131131
err = p.Kill()
132132
if err != nil {
133133
return fmt.Errorf("failed to kill process: %w", err)

pacttesting/pact_testing_integration_stage_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"testing"
1414
"time"
1515

16-
retrygo "github.com/avast/retry-go/v4"
16+
"github.com/avast/retry-go/v4"
1717
"github.com/pact-foundation/pact-go/dsl"
1818
log "github.com/sirupsen/logrus"
1919
"github.com/spf13/viper"
@@ -245,7 +245,7 @@ func (s *pactTestingStage) test_service_a_is_called() *pactTestingStage {
245245
}
246246

247247
func (s *pactTestingStage) test_service_a_was_invoked() *pactTestingStage {
248-
assert.NoError(s.t, VerifyInteractions("testservicea", "go-pact-testing", retrygo.Attempts(3)))
248+
assert.NoError(s.t, VerifyInteractions("testservicea", "go-pact-testing", retry.Attempts(3)))
249249
return s
250250
}
251251

pacttesting/testing.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"testing"
1515
"time"
1616

17-
retrygo "github.com/avast/retry-go/v4"
17+
"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"
@@ -51,11 +51,11 @@ var (
5151
pactServers = make(map[string]*MockServer)
5252
)
5353

54-
func defaultRetryOptions() []retrygo.Option {
55-
return []retrygo.Option{
56-
retrygo.Attempts(defaultRetryAttempts),
57-
retrygo.Delay(defaultRetryDelay),
58-
retrygo.DelayType(retrygo.FixedDelay),
54+
func defaultRetryOptions() []retry.Option {
55+
return []retry.Option{
56+
retry.Attempts(defaultRetryAttempts),
57+
retry.Delay(defaultRetryDelay),
58+
retry.DelayType(retry.FixedDelay),
5959
}
6060
}
6161

@@ -289,7 +289,7 @@ func AddPactInteraction(provider, consumer string, interaction *dsl.Interaction)
289289
return pactServers[key].AddInteraction(interaction)
290290
}
291291

292-
func VerifyInteractions(provider, consumer string, retryOptions ...retrygo.Option) error {
292+
func VerifyInteractions(provider, consumer string, retryOptions ...retry.Option) error {
293293
verify := func() error {
294294
key := provider + consumer
295295
err := pactServers[key].Verify()
@@ -307,7 +307,7 @@ func VerifyInteractions(provider, consumer string, retryOptions ...retrygo.Optio
307307
retryOptions = defaultRetryOptions()
308308
}
309309
cwd, _ := os.Getwd()
310-
if err := retrygo.Do(verify, retryOptions...); err != nil {
310+
if err := retry.Do(verify, retryOptions...); err != nil {
311311
return fmt.Errorf("pact interactions not matched - for details see %s/pact/logs/pact-%s.log", cwd, provider)
312312
}
313313
return nil
@@ -381,13 +381,13 @@ func EnsurePactRunning(provider, consumer string) string {
381381
Consumer: consumer,
382382
Provider: provider,
383383
}
384-
err = retrygo.Do(func() error {
384+
err = retry.Do(func() error {
385385
err := mockServer.call("GET", serverAddress, nil)
386386
if err != nil && cmd.ProcessState != nil {
387-
return fmt.Errorf("calling mock server: %w", retrygo.Unrecoverable(err))
387+
return fmt.Errorf("calling mock server: %w", retry.Unrecoverable(err))
388388
}
389389
return err
390-
}, retrygo.DelayType(retrygo.FixedDelay), retrygo.Delay(mockServerHealthDelay), retrygo.Attempts(mockServerHealthAttempts))
390+
}, retry.DelayType(retry.FixedDelay), retry.Delay(mockServerHealthDelay), retry.Attempts(mockServerHealthAttempts))
391391
if err != nil {
392392
log.
393393
WithError(err).
@@ -408,7 +408,7 @@ func EnsurePactRunning(provider, consumer string) string {
408408

409409
// Runs mock services defined by the given pacts,
410410
// invokes testFunc then verifies that the pacts have been invoked successfully
411-
func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), retryOptions ...retrygo.Option) error {
411+
func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), retryOptions ...retry.Option) error {
412412
t.Helper()
413413
return TestWithStubServices(pactFilePaths, func() {
414414
testFunc()
@@ -420,7 +420,7 @@ func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), ret
420420
retryOptions = defaultRetryOptions()
421421
}
422422
verify := func() error { return checkVerificationStatus(pactFilePaths) }
423-
if err := retrygo.Do(verify, retryOptions...); err != nil {
423+
if err := retry.Do(verify, retryOptions...); err != nil {
424424
log.Error("Pact verification failed!!" +
425425
"For more info on the error check the logs/pact*.log files, they are quite detailed")
426426
t.Error(err)
@@ -430,7 +430,7 @@ func RunIntegrationTest(t *testing.T, pactFilePaths []Pact, testFunc func(), ret
430430

431431
// Runs mock services defined by the given pacts,
432432
// invokes testFunc then verifies that the pacts have been invoked successfully
433-
func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retrygo.Option) error {
433+
func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retry.Option) error {
434434
return TestWithStubServices(pactFilePaths, func() {
435435
testFunc()
436436

@@ -441,7 +441,7 @@ func IntegrationTest(pactFilePaths []Pact, testFunc func(), retryOptions ...retr
441441
retryOptions = defaultRetryOptions()
442442
}
443443
verify := func() error { return checkVerificationStatus(pactFilePaths) }
444-
if err := retrygo.Do(verify, retryOptions...); err != nil {
444+
if err := retry.Do(verify, retryOptions...); err != nil {
445445
log.Fatalf("Pact verification failed!!" +
446446
"For more info on the error check the logs/pact*.log files, they are quite detailed")
447447
}

0 commit comments

Comments
 (0)