testutil

package
v0.0.0-...-bd4921e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchBeforeTest

func DispatchBeforeTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func MakeMockJob

func MakeMockJob(id string, name string) amboy.Job

func ManyQueueTest

func ManyQueueTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func MergeQueueTestCases

func MergeQueueTestCases(ctx context.Context, cases ...[]QueueTestCase) <-chan QueueTestCase

func MultiExecutionTest

func MultiExecutionTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func NewMockJob

func NewMockJob() amboy.Job

func NewSleepJob

func NewSleepJob(dur time.Duration) amboy.Job

func OneExecutionTest

func OneExecutionTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func OrderedTest

func OrderedTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func RandomID

func RandomID() string

func RunGroupIntegrationTest

func RunGroupIntegrationTest(bctx context.Context, t *testing.T, group GroupIntegrationCase)

func RunSerializationTest

func RunSerializationTest(ctx context.Context, t *testing.T, test QueueTestCase)

func RunSmokeTest

func RunSmokeTest(bctx context.Context, t *testing.T, test QueueTestCase)

func ScopedLockTest

func ScopedLockTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func UnorderedTest

func UnorderedTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

func WaitUntilTest

func WaitUntilTest(bctx context.Context, t *testing.T, test QueueTestCase, runner PoolTestCase, size SizeTestCase)

Types

type CounterCache

type CounterCache interface {
	Put(string, Counters)
	Get(string) Counters
	Reset(string)
}

func GetCounterCache

func GetCounterCache() CounterCache

type Counters

type Counters interface {
	Reset()
	Inc()
	Count() int
}

type GroupConstructorCase

type GroupConstructorCase struct {
	Name             string
	Valid            bool
	LocalConstructor func(context.Context) (amboy.Queue, error)
	TTL              time.Duration
	SkipRemote       bool
}

func DefaultGroupConstructorCases

func DefaultGroupConstructorCases(localConstructor QueueConstructor) []GroupConstructorCase

type GroupIntegrationCase

type GroupIntegrationCase struct {
	Name             string
	Constructor      GroupConstructor
	LocalConstructor QueueConstructor
}

type ManagerSuite

type ManagerSuite struct {
	Queue   amboy.Queue
	Manager management.Manager
	Factory func() management.Manager
	Setup   func()
	Cleanup func() error

	suite.Suite
	// contains filtered or unexported fields
}

func (*ManagerSuite) SetupTest

func (s *ManagerSuite) SetupTest()

func (*ManagerSuite) TearDownTest

func (s *ManagerSuite) TearDownTest()

func (*ManagerSuite) TestCompleteJob

func (s *ManagerSuite) TestCompleteJob()

func (*ManagerSuite) TestCompleteJobsByTypeInvalidFilter

func (s *ManagerSuite) TestCompleteJobsByTypeInvalidFilter()

func (*ManagerSuite) TestCompleteJobsByTypeValidFilter

func (s *ManagerSuite) TestCompleteJobsByTypeValidFilter()

func (*ManagerSuite) TestCompleteJobsInvalidFilter

func (s *ManagerSuite) TestCompleteJobsInvalidFilter()

func (*ManagerSuite) TestCompleteJobsValidFilter

func (s *ManagerSuite) TestCompleteJobsValidFilter()

func (*ManagerSuite) TestErrorsWithInvalidFilter

func (s *ManagerSuite) TestErrorsWithInvalidFilter()

func (*ManagerSuite) TestJobCounterHighLevel

func (s *ManagerSuite) TestJobCounterHighLevel()

func (*ManagerSuite) TestJobCountingIDHighLevel

func (s *ManagerSuite) TestJobCountingIDHighLevel()

func (*ManagerSuite) TestJobStatusInvalidFilter

func (s *ManagerSuite) TestJobStatusInvalidFilter()

func (*ManagerSuite) TestJobTiming

func (s *ManagerSuite) TestJobTiming()

func (*ManagerSuite) TestJobTimingMustBeLongerThanASecond

func (s *ManagerSuite) TestJobTimingMustBeLongerThanASecond()

func (*ManagerSuite) TestPruneCompletedJobs

func (s *ManagerSuite) TestPruneCompletedJobs()

func (*ManagerSuite) TestPruneCompletedJobsWithLimit

func (s *ManagerSuite) TestPruneCompletedJobsWithLimit()

func (*ManagerSuite) TestPrunePending

func (s *ManagerSuite) TestPrunePending()

func (*ManagerSuite) TestRecentErrors

func (s *ManagerSuite) TestRecentErrors()

func (*ManagerSuite) TestRecentJobErrors

func (s *ManagerSuite) TestRecentJobErrors()

func (*ManagerSuite) TestTimingWithInvalidFilter

func (s *ManagerSuite) TestTimingWithInvalidFilter()

type PoolTestCase

type PoolTestCase struct {
	Name         string
	SetPool      func(amboy.Queue, int) error
	SkipRemote   bool
	SkipMulti    bool
	RateLimiting bool
	MinSize      int
	MaxSize      int
}

func DefaultPoolTestCases

func DefaultPoolTestCases() []PoolTestCase

type QueueConstructor

type QueueConstructor func(context.Context) (amboy.Queue, error)

type QueueTestCase

type QueueTestCase struct {
	Name                    string
	Constructor             func(context.Context, string, int) (amboy.Queue, TestCloser, error)
	MinSize                 int
	MaxSize                 int
	DisableParallelTests    bool
	SingleWorker            bool
	MultiSupported          bool
	OrderedSupported        bool
	OrderedStartsBefore     bool
	WaitUntilSupported      bool
	DispatchBeforeSupported bool
	SkipUnordered           bool
	IsRemote                bool
	Skip                    bool
}

type SizeTestCase

type SizeTestCase struct {
	Name string
	Size int
}

func DefaultSizeTestCases

func DefaultSizeTestCases() []SizeTestCase

type TestCloser

type TestCloser func(context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL