testing

package
v0.0.0-...-36fcf6a Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLogger

func CheckLogger(t *testing.T, buf fmt.Stringer)

CheckLogger checks the output for errors and fatals

func NewTestLogger

func NewTestLogger() (*bytes.Buffer, *logrus.Entry)

NewTestLogger returns a logger with buffer setup, so that nothing really get's logged.

Types

type NoopAcknowledger

type NoopAcknowledger struct{}

NoopAcknowledger doesn't really do something.

func (*NoopAcknowledger) Ack

func (a *NoopAcknowledger) Ack(tag uint64, multiple bool) error

Ack doesn't do something.

func (*NoopAcknowledger) Nack

func (a *NoopAcknowledger) Nack(tag uint64, multiple bool, requeue bool) error

Nack doesn't do something.

func (*NoopAcknowledger) Reject

func (a *NoopAcknowledger) Reject(tag uint64, requeue bool) error

Reject doesn't do something.

type TestDB

type TestDB struct {
	SavedJobs, DeletedJobs, Jobs []*api.Job
}

TestDB is a db implementation used for testing

func NewTestDB

func NewTestDB() *TestDB

NewTestDB returns a new TestDB instance

func (*TestDB) Delete

func (t *TestDB) Delete(job *api.Job) error

Delete adds the given job to the deletedJobs field

func (*TestDB) Get

func (t *TestDB) Get(id string) (*api.Job, error)

Get returns the first job from the Jobs field with an equal UUID

func (*TestDB) GetList

func (t *TestDB) GetList(page, perPage int) ([]*api.Job, error)

GetList returns all jobs withing the Jobs field

func (*TestDB) GetListByStatus

func (t *TestDB) GetListByStatus(status string, page, perPage int) ([]*api.Job, error)

GetListByStatus returns all jobs withing the Jobs field

func (*TestDB) GetUUIDs

func (t *TestDB) GetUUIDs(jobs []*api.Job) (ids []string)

GetUUIDs returns the UUIDs of the given jobs

func (*TestDB) Save

func (t *TestDB) Save(job *api.Job) error

Save adds the given job to the savedJobs field

type TestQueue

type TestQueue struct {
	QueuesDeclared []string
	Messages       [][]byte
}

TestQueue for tests which buffers the messages

func NewTestQueue

func NewTestQueue() *TestQueue

NewTestQueue returns a new TestQueue instance

func (*TestQueue) Consume

func (t *TestQueue) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) (<-chan amqp.Delivery, error)

Consume just pushes all messages from the Messages field into the channel.

func (*TestQueue) Publish

func (t *TestQueue) Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error

Publish adds the given message to the Messages field.

func (*TestQueue) Qos

func (t *TestQueue) Qos(prefetchCount, prefetchSize int, global bool) error

Qos doesn't really do something.

func (*TestQueue) QueueDeclare

func (t *TestQueue) QueueDeclare(name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) (amqp.Queue, error)

QueueDeclare doesn't really do something.

Jump to

Keyboard shortcuts

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