Skip to content

Commit

Permalink
✅ Add test of internal/worker/queue_option (#613)
Browse files Browse the repository at this point in the history
* ✅ Add test of internal/worker/queue_option

Signed-off-by: vankichi <kyukawa315@gmail.com>

* ✅ Update internal/worker/queue_option_test.go

Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>

* ✅ Update internal/worker/queue_option_test.go

Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>

Co-authored-by: Hiroto Funakoshi <hiroto.funakoshi.hiroto@gmail.com>
  • Loading branch information
vankichi and hlts2 authored Aug 7, 2020
1 parent dc2dcee commit d4fa50b
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 258 deletions.
5 changes: 5 additions & 0 deletions internal/worker/queue_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/vdaas/vald/internal/timeutil"
)

// QueueOption represents the functional option for queue.
type QueueOption func(q *queue) error

var (
Expand All @@ -32,6 +33,7 @@ var (
}
)

// WithQueueBuffer returns the option to set the buffer for queue.
func WithQueueBuffer(buffer int) QueueOption {
return func(q *queue) error {
if buffer > 0 {
Expand All @@ -41,6 +43,7 @@ func WithQueueBuffer(buffer int) QueueOption {
}
}

// WithQueueErrGroup returns the options to set the eg for queue.
func WithQueueErrGroup(eg errgroup.Group) QueueOption {
return func(q *queue) error {
if eg != nil {
Expand All @@ -50,6 +53,8 @@ func WithQueueErrGroup(eg errgroup.Group) QueueOption {
}
}

// WithQueueCheckDuration returns the option to set the qcdur for queue.
// If dur is invalid string, it returns errror.
func WithQueueCheckDuration(dur string) QueueOption {
return func(q *queue) error {
if len(dur) == 0 {
Expand Down
Loading

0 comments on commit d4fa50b

Please sign in to comment.