Skip to content

Commit

Permalink
chore(testing): remove empty worker.
Browse files Browse the repository at this point in the history
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed Apr 6, 2022
1 parent 3404d97 commit d1132ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
12 changes: 9 additions & 3 deletions queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"time"

"github.com/golang-queue/queue/core"
"github.com/golang-queue/queue/mocks"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"go.uber.org/goleak"
)
Expand All @@ -23,11 +25,16 @@ func (m mockMessage) Bytes() []byte {
}

func TestNewQueue(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()

q, err := NewQueue()
assert.Error(t, err)
assert.Nil(t, q)

w := &emptyWorker{}
w := mocks.NewMockWorker(controller)
w.EXPECT().Shutdown().Return(nil)
w.EXPECT().Request().Return(nil, nil)
q, err = NewQueue(
WithWorker(w),
)
Expand All @@ -36,8 +43,7 @@ func TestNewQueue(t *testing.T) {

q.Start()
assert.Equal(t, 0, q.BusyWorkers())
q.Shutdown()
q.Wait()
q.Release()
}

func TestShtdonwOnce(t *testing.T) {
Expand Down
13 changes: 0 additions & 13 deletions worker_empty.go

This file was deleted.

0 comments on commit d1132ff

Please sign in to comment.