File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ require (
6
6
github.com/go-redis/redis/v8 v8.11.3
7
7
github.com/golang-queue/queue v0.0.11
8
8
github.com/stretchr/testify v1.7.0
9
+ go.uber.org/goleak v1.1.12
9
10
)
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ
57
57
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 /go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w =
58
58
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 /go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI =
59
59
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 /go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto =
60
+ golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs =
60
61
golang.org/x/lint v0.0.0-20190930215403-16217165b5de /go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc =
61
62
golang.org/x/mod v0.3.0 /go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA =
62
63
golang.org/x/mod v0.4.2 /go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA =
@@ -96,6 +97,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
96
97
golang.org/x/tools v0.0.0-20190311212946-11955173bddd /go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs =
97
98
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e /go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo =
98
99
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e /go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA =
100
+ golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA =
99
101
golang.org/x/tools v0.1.5 /go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk =
100
102
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
101
103
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 /go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0 =
Original file line number Diff line number Diff line change @@ -13,10 +13,15 @@ import (
13
13
"github.com/golang-queue/queue"
14
14
15
15
"github.com/stretchr/testify/assert"
16
+ "go.uber.org/goleak"
16
17
)
17
18
18
19
var host = "127.0.0.1"
19
20
21
+ func TestMain (m * testing.M ) {
22
+ goleak .VerifyTestMain (m )
23
+ }
24
+
20
25
type mockMessage struct {
21
26
Message string
22
27
}
@@ -327,6 +332,7 @@ func TestHandleTimeout(t *testing.T) {
327
332
err := w .handle (job )
328
333
assert .Error (t , err )
329
334
assert .Equal (t , context .DeadlineExceeded , err )
335
+ assert .NoError (t , w .Shutdown ())
330
336
331
337
job = queue.Job {
332
338
Timeout : 150 * time .Millisecond ,
@@ -366,6 +372,7 @@ func TestJobComplete(t *testing.T) {
366
372
err := w .handle (job )
367
373
assert .Error (t , err )
368
374
assert .Equal (t , errors .New ("job completed" ), err )
375
+ assert .NoError (t , w .Shutdown ())
369
376
370
377
job = queue.Job {
371
378
Timeout : 250 * time .Millisecond ,
You can’t perform that action at this time.
0 commit comments