Skip to content

Commit 62454a8

Browse files
committed
chore(dependencies): upgrade modules
This commit upgrades the retry library which includes the UnWrap method on the StopError for bubbling it up correctly.
1 parent ccf1ad9 commit 62454a8

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- feature/*
1010
- bugfix/*
1111
- refactor/*
12+
- chore/*
1213

1314
jobs:
1415
test:

db_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func testTransactionPGX(t *testing.T) {
6666
t.Run("CancelledContext", testTransactionPGXCancelledContext)
6767
t.Run("Panic", testTransactionPGXPanic)
6868
t.Run("AnError", testTransactionPGXAnError)
69+
t.Run("ErrorIs", testTransactionPGXErrorIs)
6970
t.Run("RollbackError", testTransactionPGXRollbackError)
7071
t.Run("CommitError", testTransactionPGXCommitError)
7172
t.Run("ShortStop", testTransactionPGXShortStop)
@@ -246,6 +247,28 @@ func testTransactionPGXAnError(t *testing.T) {
246247
assert.Equal(t, total, calls)
247248
}
248249

250+
func testTransactionPGXErrorIs(t *testing.T) {
251+
t.Parallel()
252+
db := &mocks.Pool{}
253+
defer db.AssertExpectations(t)
254+
ctx, cancel := context.WithCancel(context.Background())
255+
defer cancel()
256+
257+
tr, err := dbtools.NewTransaction(db, dbtools.RetryCount(1))
258+
require.NoError(t, err)
259+
260+
tx := &mocks.PGXTx{}
261+
defer tx.AssertExpectations(t)
262+
263+
db.On("Begin", mock.Anything).Return(tx, nil)
264+
tx.On("Rollback", mock.Anything).Return(nil).Maybe()
265+
266+
err = tr.PGX(ctx, func(pgx.Tx) error {
267+
return &retry.StopError{Err: assert.AnError}
268+
})
269+
assert.True(t, errors.Is(err, assert.AnError))
270+
}
271+
249272
func testTransactionPGXRollbackError(t *testing.T) {
250273
t.Parallel()
251274
db := &mocks.Pool{}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ go 1.18
44

55
require (
66
github.com/DATA-DOG/go-sqlmock v1.5.0
7-
github.com/arsham/retry v0.4.1
7+
github.com/arsham/retry v0.5.0
88
github.com/hashicorp/go-multierror v1.1.1
99
github.com/jackc/pgconn v1.11.0
1010
github.com/jackc/pgx/v4 v4.15.0
1111
github.com/pkg/errors v0.9.1
1212
github.com/sclevine/spec v1.4.0
13-
github.com/stretchr/testify v1.7.0
13+
github.com/stretchr/testify v1.7.1
1414
github.com/testcontainers/testcontainers-go v0.12.0
1515
)
1616

@@ -52,9 +52,9 @@ require (
5252
go.opencensus.io v0.23.0 // indirect
5353
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
5454
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
55-
golang.org/x/sys v0.0.0-20220315180522-27bbf83dae87 // indirect
55+
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 // indirect
5656
golang.org/x/text v0.3.7 // indirect
57-
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 // indirect
57+
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e // indirect
5858
google.golang.org/grpc v1.45.0 // indirect
5959
google.golang.org/protobuf v1.27.1 // indirect
6060
gopkg.in/yaml.v2 v2.4.0 // indirect

go.sum

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
111111
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
112112
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
113113
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
114-
github.com/arsham/retry v0.4.1 h1:nt9NmOsJTm0bP5jh2OnxAtHV3vX6RPXKyBi/X27CDRM=
115-
github.com/arsham/retry v0.4.1/go.mod h1:E3j9FunXJZy8fU19eSyyOSz4a2b+0YCvwtxDEOFnOiI=
114+
github.com/arsham/retry v0.5.0 h1:u9FyqYTDykxCJv6g05r8yvvBWLsb/zBhQH8ItdZ7oSs=
115+
github.com/arsham/retry v0.5.0/go.mod h1:zl7ydR1abWXWqc9+9vKHvwAXp+clY1Pzc6nJ9CSS7W8=
116116
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
117117
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
118118
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
@@ -880,8 +880,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
880880
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
881881
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
882882
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
883-
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
884883
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
884+
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
885+
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
885886
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
886887
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
887888
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
@@ -1222,8 +1223,8 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc
12221223
golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12231224
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12241225
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1225-
golang.org/x/sys v0.0.0-20220315180522-27bbf83dae87 h1:CdpUJojjGE1hEo9rQtAdH5Bc80IaSzwA+ZiGqYutf24=
1226-
golang.org/x/sys v0.0.0-20220315180522-27bbf83dae87/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1226+
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 h1:saXMvIOKvRFwbOMicHXr0B1uwoxq9dGmLe5ExMES6c4=
1227+
golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
12271228
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
12281229
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
12291230
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -1402,8 +1403,8 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE
14021403
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
14031404
google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
14041405
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
1405-
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 h1:ErU+UA6wxadoU8nWrsy5MZUVBs75K17zUCsUCIfrXCE=
1406-
google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
1406+
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg=
1407+
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
14071408
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
14081409
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
14091410
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=

0 commit comments

Comments
 (0)