Skip to content

Commit 5f96dfe

Browse files
committed
feat: add consumer, handler, service unit tests
1 parent ba3acff commit 5f96dfe

17 files changed

Lines changed: 2052 additions & 43 deletions

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: fmt build build-api build-consumer lint swagger env
1+
.PHONY: fmt build build-api build-consumer test test-no-race lint swagger env
22

33
fmt:
44
@echo "Formatting code..."
@@ -16,7 +16,7 @@ build-consumer:
1616

1717
test:
1818
@echo "Running tests..."
19-
@go test -v -race ./...
19+
@CGO_ENABLED=1 go test -v -race ./...
2020

2121
lint:
2222
@echo "Running linter..."

go.mod

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ require (
1111
github.com/aws/aws-sdk-go-v2/service/sqs v1.42.20
1212
github.com/gin-gonic/gin v1.11.0
1313
github.com/google/uuid v1.6.0
14+
github.com/stretchr/testify v1.11.1
1415
github.com/swaggo/files v1.0.1
1516
github.com/swaggo/gin-swagger v1.6.1
1617
github.com/swaggo/swag v1.16.6
17-
go.uber.org/zap v1.27.0
18+
go.uber.org/zap v1.27.1
1819
)
1920

2021
require (
@@ -37,6 +38,7 @@ require (
3738
github.com/bytedance/sonic/loader v0.4.0 // indirect
3839
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3940
github.com/cloudwego/base64x v0.1.6 // indirect
41+
github.com/davecgh/go-spew v1.1.1 // indirect
4042
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
4143
github.com/gin-contrib/sse v1.1.0 // indirect
4244
github.com/go-faster/city v1.0.1 // indirect
@@ -57,19 +59,21 @@ require (
5759
github.com/goccy/go-json v0.10.5 // indirect
5860
github.com/goccy/go-yaml v1.19.1 // indirect
5961
github.com/json-iterator/go v1.1.12 // indirect
60-
github.com/klauspost/compress v1.18.0 // indirect
62+
github.com/klauspost/compress v1.18.2 // indirect
6163
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
6264
github.com/leodido/go-urn v1.4.0 // indirect
6365
github.com/mattn/go-isatty v0.0.20 // indirect
6466
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6567
github.com/modern-go/reflect2 v1.0.2 // indirect
6668
github.com/paulmach/orb v0.12.0 // indirect
6769
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
68-
github.com/pierrec/lz4/v4 v4.1.22 // indirect
70+
github.com/pierrec/lz4/v4 v4.1.23 // indirect
71+
github.com/pmezard/go-difflib v1.0.0 // indirect
6972
github.com/quic-go/qpack v0.6.0 // indirect
7073
github.com/quic-go/quic-go v0.58.0 // indirect
7174
github.com/segmentio/asm v1.2.1 // indirect
7275
github.com/shopspring/decimal v1.4.0 // indirect
76+
github.com/stretchr/objx v0.5.2 // indirect
7377
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
7478
github.com/ugorji/go/codec v1.3.1 // indirect
7579
go.opentelemetry.io/otel v1.39.0 // indirect
@@ -86,4 +90,5 @@ require (
8690
golang.org/x/text v0.32.0 // indirect
8791
golang.org/x/tools v0.40.0 // indirect
8892
google.golang.org/protobuf v1.36.11 // indirect
93+
gopkg.in/yaml.v3 v3.0.1 // indirect
8994
)

go.sum

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
117117
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
118118
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
119119
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
120-
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
121-
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
120+
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
121+
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
122122
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
123123
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
124124
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -143,8 +143,8 @@ github.com/paulmach/orb v0.12.0/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/En
143143
github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY=
144144
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
145145
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
146-
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
147-
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
146+
github.com/pierrec/lz4/v4 v4.1.23 h1:oJE7T90aYBGtFNrI8+KbETnPymobAhzRrR8Mu8n1yfU=
147+
github.com/pierrec/lz4/v4 v4.1.23/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4=
148148
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
149149
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
150150
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -161,6 +161,7 @@ github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+D
161161
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
162162
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
163163
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
164+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
164165
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
165166
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
166167
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -201,8 +202,8 @@ go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
201202
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
202203
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
203204
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
204-
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
205-
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
205+
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
206+
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
206207
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
207208
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
208209
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=

0 commit comments

Comments
 (0)