From fcfa195bc637f8d07b9c7432e3c1f78ab5692eaa Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 24 Jul 2021 11:11:13 +0800 Subject: [PATCH] chore(queue): add custom logger. Signed-off-by: Bo-Yi Wu --- queue/simple/simple_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/queue/simple/simple_test.go b/queue/simple/simple_test.go index a03b66c..9d5b192 100644 --- a/queue/simple/simple_test.go +++ b/queue/simple/simple_test.go @@ -94,6 +94,9 @@ func TestShutDonwPanic(t *testing.T) { } func TestWorkersNum(t *testing.T) { + m := mockMessage{ + msg: "test", + } w := NewWorker( WithRunFunc(func(msg queue.QueuedMessage) error { logx.LogAccess.Infof("get message: %s", msg.Bytes()) @@ -104,12 +107,17 @@ func TestWorkersNum(t *testing.T) { q, err := queue.NewQueue( queue.WithWorker(w), queue.WithWorkerCount(2), + queue.WithLogger(logx.LogAccess), ) assert.NoError(t, err) q.Start() q.Start() q.Start() q.Start() + q.Queue(m) + q.Queue(m) + q.Queue(m) + q.Queue(m) time.Sleep(50 * time.Millisecond) assert.Equal(t, 8, q.Workers()) q.Shutdown()