Skip to content

Commit ac3aee5

Browse files
chore: workaround for false-positive lint error
1 parent c4daead commit ac3aee5

6 files changed

Lines changed: 24 additions & 22 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
*.out
1313
.idea
1414

15+
.gocache/
16+
1517
pacttesting/target
1618
pacttesting/logs
1719
pact/

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Using golangci-lint@v1.56.2
1+
# Using golangci-lint@v1.61.0
22
run:
33
timeout: 5m
44
tests: true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := default
22

3-
GOLANGCI_VERSION := 1.56.2
3+
GOLANGCI_VERSION := 1.61.0
44

55
platform := $(shell uname)
66
pact_version := "1.88.51"

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-
"github.com/avast/retry-go/v4"
15+
retrygo "github.com/avast/retry-go/v4"
1616
log "github.com/sirupsen/logrus"
1717
)
1818

@@ -113,14 +113,14 @@ func (m *MockServer) Stop() error {
113113

114114
// wait for process to exit after interrupt, if it fails to stop
115115
// then kill it
116-
if err := retry.Do(func() error {
116+
if err := retrygo.Do(func() error {
117117
// check if the process is still alive
118118
err := p.Signal(syscall.Signal(0))
119119
if err == nil {
120120
return errors.New("server process is still alive")
121121
}
122122
return nil
123-
}, retry.Attempts(25), retry.Delay(200*time.Millisecond), retry.DelayType(retry.FixedDelay)); err != nil {
123+
}, retrygo.Attempts(25), retrygo.Delay(200*time.Millisecond), retrygo.DelayType(retrygo.FixedDelay)); err != nil {
124124
err = p.Kill()
125125
if err != nil {
126126
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-
"github.com/avast/retry-go/v4"
16+
retrygo "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", retry.Attempts(3)))
248+
assert.NoError(s.t, VerifyInteractions("testservicea", "go-pact-testing", retrygo.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-
"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

Comments
 (0)