@@ -10,6 +10,7 @@ import (
10
10
"time"
11
11
12
12
"github.com/golang-queue/queue"
13
+ "github.com/golang-queue/queue/core"
13
14
14
15
"github.com/stretchr/testify/assert"
15
16
"go.uber.org/goleak"
@@ -77,7 +78,7 @@ func TestNATSCustomFuncAndWait(t *testing.T) {
77
78
WithAddr (host + ":4222" ),
78
79
WithSubj ("test" ),
79
80
WithQueue ("test" ),
80
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
81
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
81
82
log .Println ("show message: " + string (m .Bytes ()))
82
83
time .Sleep (500 * time .Millisecond )
83
84
return nil
@@ -130,7 +131,7 @@ func TestJobReachTimeout(t *testing.T) {
130
131
WithAddr (host + ":4222" ),
131
132
WithSubj ("JobReachTimeout" ),
132
133
WithQueue ("test" ),
133
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
134
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
134
135
for {
135
136
select {
136
137
case <- ctx .Done ():
@@ -169,7 +170,7 @@ func TestCancelJobAfterShutdown(t *testing.T) {
169
170
WithSubj ("CancelJob" ),
170
171
WithQueue ("test" ),
171
172
WithLogger (queue .NewLogger ()),
172
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
173
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
173
174
for {
174
175
select {
175
176
case <- ctx .Done ():
@@ -208,7 +209,7 @@ func TestGoroutineLeak(t *testing.T) {
208
209
WithSubj ("GoroutineLeak" ),
209
210
WithQueue ("test" ),
210
211
WithLogger (queue .NewEmptyLogger ()),
211
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
212
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
212
213
for {
213
214
select {
214
215
case <- ctx .Done ():
@@ -252,7 +253,7 @@ func TestGoroutinePanic(t *testing.T) {
252
253
w := NewWorker (
253
254
WithAddr (host + ":4222" ),
254
255
WithSubj ("GoroutinePanic" ),
255
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
256
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
256
257
panic ("missing something" )
257
258
}),
258
259
)
@@ -278,7 +279,7 @@ func TestHandleTimeout(t *testing.T) {
278
279
}
279
280
w := NewWorker (
280
281
WithAddr (host + ":4222" ),
281
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
282
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
282
283
time .Sleep (200 * time .Millisecond )
283
284
return nil
284
285
}),
@@ -296,7 +297,7 @@ func TestHandleTimeout(t *testing.T) {
296
297
297
298
w = NewWorker (
298
299
WithAddr (host + ":4222" ),
299
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
300
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
300
301
time .Sleep (200 * time .Millisecond )
301
302
return nil
302
303
}),
@@ -321,7 +322,7 @@ func TestJobComplete(t *testing.T) {
321
322
}
322
323
w := NewWorker (
323
324
WithAddr (host + ":4222" ),
324
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
325
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
325
326
return errors .New ("job completed" )
326
327
}),
327
328
)
@@ -338,7 +339,7 @@ func TestJobComplete(t *testing.T) {
338
339
339
340
w = NewWorker (
340
341
WithAddr (host + ":4222" ),
341
- WithRunFunc (func (ctx context.Context , m queue .QueuedMessage ) error {
342
+ WithRunFunc (func (ctx context.Context , m core .QueuedMessage ) error {
342
343
time .Sleep (200 * time .Millisecond )
343
344
return errors .New ("job completed" )
344
345
}),
0 commit comments