...

Package testqueue

import "github.com/datawire/ambassador/v2/cmd/entrypoint/internal/testqueue"
Overview
Index

Overview ▾

type Queue

The Queue struct implements a multi-writer/multi-reader concurrent queue where the dequeue operation (the Get() method) takes a predicate that allows it to skip past queue entries until it finds one that satisfies the specified predicate.

type Queue struct {
    // contains filtered or unexported fields
}

func NewQueue

func NewQueue(t *testing.T, timeout time.Duration) *Queue

NewQueue constructs a new queue with the supplied timeout.

func (*Queue) Add

func (q *Queue) Add(t *testing.T, obj interface{})

Add an entry to the queue.

func (*Queue) AssertEmpty

func (q *Queue) AssertEmpty(t *testing.T, timeout time.Duration, msg string)

AssertEmpty will check that the queue remains empty for the supplied duration.

func (*Queue) Get

func (q *Queue) Get(t *testing.T, predicate func(interface{}) bool) (interface{}, error)

Get will return the next entry that satisfies the supplied predicate.