mocks

package
v0.0.0-...-c6cd810 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockDelivery

func NewMockDelivery(data []byte, tag uint64, acknowledger *MockAcknowledger) amqp.Delivery

NewMockDelivery creates an amqp.Delivery from a parsed log entry, filling only the properties to used by the processor code.

Types

type EsClientMock

type EsClientMock struct {
	Indexes map[string][]models.ESDocument
}

EsClientMock is a mock Elasticsearch client used in tests.

func NewESClientMock

func NewESClientMock(indexes map[string][]models.ESDocument) *EsClientMock

func (*EsClientMock) BulkUpload

func (m *EsClientMock) BulkUpload(dataUnits []models.ESDocument, indexName string)

BulkUpload mocks the BulkUpload function of the EsClient interface.

func (*EsClientMock) CreateEsIndex

func (m *EsClientMock) CreateEsIndex(index string)

CreateEsIndex mocks the CreateEsIndex function of the EsClient interface.

type MessageConsumerMock

type MessageConsumerMock struct {
	TestData testmodels.TestProcessedData
	// contains filtered or unexported fields
}

MessageConsumerMock is a mock MessageConsumer consumer used in tests.

func NewMessageConsumerMock

func NewMessageConsumerMock(
	testData testmodels.TestProcessedData,
	allMessagesAcknowledged chan bool,
	deliveryDelaySeconds int,
	expectedDocCount int,
) *MessageConsumerMock

NewMessageConsumerMock creates a new mock consumer for providing processed data messages for the ulpoader service. The testData will be used to create the processed data messages from. The done channel is used to signal after all messages have been acknowledged. The deliveryDelaySeconds is used to add an artificial delay after the first message, to test the timed index recreation behaviour, it is ignored if set to zero.

func (*MessageConsumerMock) CloseChannelAndConnection

func (m *MessageConsumerMock) CloseChannelAndConnection()

func (*MessageConsumerMock) Connect

func (m *MessageConsumerMock) Connect()

func (*MessageConsumerMock) Consume

func (m *MessageConsumerMock) Consume() (<-chan amqp.Delivery, error)

ConsumeMessages creates a channel from the parsed log file of the MockMessageConsumer.

type MockAcknowledger

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

MockAcknowledger implements the Acknowledger interface of amqp.

func NewMockAcknowleder

func NewMockAcknowleder(expectedAckCount int, allMessagesAcknowledged chan bool) *MockAcknowledger

func (*MockAcknowledger) Ack

func (m *MockAcknowledger) Ack(tag uint64, multiple bool) error

Ack is the implementation of the Ack() function of the Acknowledger interface.

func (*MockAcknowledger) Nack

func (m *MockAcknowledger) Nack(tag uint64, multiple bool, requeue bool) error

Nack is the implementation of the Nack() function of the Acknowledger interface.

func (*MockAcknowledger) Reject

func (m *MockAcknowledger) Reject(tag uint64, requeue bool) error

Reject is the implementation of the Reject() function of the Acknowledger interface.

Jump to

Keyboard shortcuts

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