test_helper

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package mock is a generated GoMock package.

Package mock is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CrappyJson

func CrappyJson[T CrappyShouldError]() format.Format[T]

func CrappyStringFormat

func CrappyStringFormat() format.Format[string]

func Log

func Log(t *testing.T, container testcontainers.Container)

func LogContains

func LogContains(t *testing.T, container testcontainers.Container, logString string) bool

func MarshalNoError

func MarshalNoError[T any](t *testing.T, f format.Format[T], v T) []byte

func UnmarshalNoError

func UnmarshalNoError[T any](t *testing.T, f format.Format[T], bytes []byte) T

Types

type BunIDB

type BunIDB interface {
	bun.IDB
}

type ChannelProducer

type ChannelProducer struct {
	Messages chan flow.Message[structure.Bytes, structure.Bytes]
}

func NewChannelProducer

func NewChannelProducer() *ChannelProducer

func (*ChannelProducer) Produce

func (*ChannelProducer) Start

func (c *ChannelProducer) Start() error

func (*ChannelProducer) Stop

func (c *ChannelProducer) Stop()

type ConsumerGroupSession

type ConsumerGroupSession interface {
	// Claims returns information about the claimed partitions by topic.
	Claims() map[string][]int32

	// MemberID returns the cluster member ID.
	MemberID() string

	// GenerationID returns the current generation ID.
	GenerationID() int32

	// MarkOffset marks the provided offset, alongside a metadata string
	// that represents the state of the partition consumer at that point in time. The
	// metadata string can be used by another consumer to restore that state, so it
	// can resume consumption.
	//
	// To follow upstream conventions, you are expected to mark the offset of the
	// next message to read, not the last message read. Thus, when calling `MarkOffset`
	// you should typically add one to the offset of the last consumed message.
	//
	// Note: calling MarkOffset does not necessarily commit the offset to the backend
	// store immediately for efficiency reasons, and it may never be committed if
	// your application crashes. This means that you may end up processing the same
	// message twice, and your processing should ideally be idempotent.
	MarkOffset(topic string, partition int32, offset int64, metadata string)

	// Commit the offset to the backend
	//
	// Note: calling Commit performs a blocking synchronous operation.
	Commit()

	// ResetOffset resets to the provided offset, alongside a metadata string that
	// represents the state of the partition consumer at that point in time. Reset
	// acts as a counterpart to MarkOffset, the difference being that it allows to
	// reset an offset to an earlier or smaller value, where MarkOffset only
	// allows incrementing the offset. cf MarkOffset for more details.
	ResetOffset(topic string, partition int32, offset int64, metadata string)

	// MarkMessage marks a message as consumed.
	MarkMessage(msg *sarama.ConsumerMessage, metadata string)

	// Context returns the session context.
	Context() context.Context
}

ConsumerGroupSession represents a consumer group member session.

type CrappyJsonFormat

type CrappyJsonFormat[T CrappyShouldError] struct{}

func (CrappyJsonFormat[T]) Default

func (helper CrappyJsonFormat[T]) Default() T

func (CrappyJsonFormat[T]) Marshal

func (helper CrappyJsonFormat[T]) Marshal(value T) ([]byte, error)

func (CrappyJsonFormat[T]) Unmarshal

func (helper CrappyJsonFormat[T]) Unmarshal(value []byte) (T, error)

type CrappyShouldError

type CrappyShouldError interface {
	ShouldError() bool
}

type MockBunConnection

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

MockBunConnection is a mock of BunConnection interface.

func NewMockBunConnection

func NewMockBunConnection(ctrl *gomock.Controller) *MockBunConnection

NewMockBunConnection creates a new mock instance.

func (*MockBunConnection) Db

func (m *MockBunConnection) Db() bun.IDB

Db mocks base method.

func (*MockBunConnection) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBunConnection) Start

func (m *MockBunConnection) Start() error

Start mocks base method.

func (*MockBunConnection) Stop

func (m *MockBunConnection) Stop()

Stop mocks base method.

type MockBunConnectionMockRecorder

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

MockBunConnectionMockRecorder is the mock recorder for MockBunConnection.

func (*MockBunConnectionMockRecorder) Db

Db indicates an expected call of Db.

func (*MockBunConnectionMockRecorder) Start

Start indicates an expected call of Start.

func (*MockBunConnectionMockRecorder) Stop

Stop indicates an expected call of Stop.

type MockBunIDB

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

MockBunIDB is a mock of BunIDB interface.

func NewMockBunIDB

func NewMockBunIDB(ctrl *gomock.Controller) *MockBunIDB

NewMockBunIDB creates a new mock instance.

func (*MockBunIDB) BeginTx

func (m *MockBunIDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (bun.Tx, error)

BeginTx mocks base method.

func (*MockBunIDB) Dialect

func (m *MockBunIDB) Dialect() schema.Dialect

Dialect mocks base method.

func (*MockBunIDB) EXPECT

func (m *MockBunIDB) EXPECT() *MockBunIDBMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBunIDB) ExecContext

func (m *MockBunIDB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

ExecContext mocks base method.

func (*MockBunIDB) NewAddColumn

func (m *MockBunIDB) NewAddColumn() *bun.AddColumnQuery

NewAddColumn mocks base method.

func (*MockBunIDB) NewCreateIndex

func (m *MockBunIDB) NewCreateIndex() *bun.CreateIndexQuery

NewCreateIndex mocks base method.

func (*MockBunIDB) NewCreateTable

func (m *MockBunIDB) NewCreateTable() *bun.CreateTableQuery

NewCreateTable mocks base method.

func (*MockBunIDB) NewDelete

func (m *MockBunIDB) NewDelete() *bun.DeleteQuery

NewDelete mocks base method.

func (*MockBunIDB) NewDropColumn

func (m *MockBunIDB) NewDropColumn() *bun.DropColumnQuery

NewDropColumn mocks base method.

func (*MockBunIDB) NewDropIndex

func (m *MockBunIDB) NewDropIndex() *bun.DropIndexQuery

NewDropIndex mocks base method.

func (*MockBunIDB) NewDropTable

func (m *MockBunIDB) NewDropTable() *bun.DropTableQuery

NewDropTable mocks base method.

func (*MockBunIDB) NewInsert

func (m *MockBunIDB) NewInsert() *bun.InsertQuery

NewInsert mocks base method.

func (*MockBunIDB) NewRaw

func (m *MockBunIDB) NewRaw(query string, args ...interface{}) *bun.RawQuery

NewRaw mocks base method.

func (*MockBunIDB) NewSelect

func (m *MockBunIDB) NewSelect() *bun.SelectQuery

NewSelect mocks base method.

func (*MockBunIDB) NewTruncateTable

func (m *MockBunIDB) NewTruncateTable() *bun.TruncateTableQuery

NewTruncateTable mocks base method.

func (*MockBunIDB) NewUpdate

func (m *MockBunIDB) NewUpdate() *bun.UpdateQuery

NewUpdate mocks base method.

func (*MockBunIDB) NewValues

func (m *MockBunIDB) NewValues(model interface{}) *bun.ValuesQuery

NewValues mocks base method.

func (*MockBunIDB) QueryContext

func (m *MockBunIDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

QueryContext mocks base method.

func (*MockBunIDB) QueryRowContext

func (m *MockBunIDB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

QueryRowContext mocks base method.

func (*MockBunIDB) RunInTx

func (m *MockBunIDB) RunInTx(ctx context.Context, opts *sql.TxOptions, f func(context.Context, bun.Tx) error) error

RunInTx mocks base method.

type MockBunIDBMockRecorder

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

MockBunIDBMockRecorder is the mock recorder for MockBunIDB.

func (*MockBunIDBMockRecorder) BeginTx

func (mr *MockBunIDBMockRecorder) BeginTx(ctx, opts interface{}) *gomock.Call

BeginTx indicates an expected call of BeginTx.

func (*MockBunIDBMockRecorder) Dialect

func (mr *MockBunIDBMockRecorder) Dialect() *gomock.Call

Dialect indicates an expected call of Dialect.

func (*MockBunIDBMockRecorder) ExecContext

func (mr *MockBunIDBMockRecorder) ExecContext(ctx, query interface{}, args ...interface{}) *gomock.Call

ExecContext indicates an expected call of ExecContext.

func (*MockBunIDBMockRecorder) NewAddColumn

func (mr *MockBunIDBMockRecorder) NewAddColumn() *gomock.Call

NewAddColumn indicates an expected call of NewAddColumn.

func (*MockBunIDBMockRecorder) NewCreateIndex

func (mr *MockBunIDBMockRecorder) NewCreateIndex() *gomock.Call

NewCreateIndex indicates an expected call of NewCreateIndex.

func (*MockBunIDBMockRecorder) NewCreateTable

func (mr *MockBunIDBMockRecorder) NewCreateTable() *gomock.Call

NewCreateTable indicates an expected call of NewCreateTable.

func (*MockBunIDBMockRecorder) NewDelete

func (mr *MockBunIDBMockRecorder) NewDelete() *gomock.Call

NewDelete indicates an expected call of NewDelete.

func (*MockBunIDBMockRecorder) NewDropColumn

func (mr *MockBunIDBMockRecorder) NewDropColumn() *gomock.Call

NewDropColumn indicates an expected call of NewDropColumn.

func (*MockBunIDBMockRecorder) NewDropIndex

func (mr *MockBunIDBMockRecorder) NewDropIndex() *gomock.Call

NewDropIndex indicates an expected call of NewDropIndex.

func (*MockBunIDBMockRecorder) NewDropTable

func (mr *MockBunIDBMockRecorder) NewDropTable() *gomock.Call

NewDropTable indicates an expected call of NewDropTable.

func (*MockBunIDBMockRecorder) NewInsert

func (mr *MockBunIDBMockRecorder) NewInsert() *gomock.Call

NewInsert indicates an expected call of NewInsert.

func (*MockBunIDBMockRecorder) NewRaw

func (mr *MockBunIDBMockRecorder) NewRaw(query interface{}, args ...interface{}) *gomock.Call

NewRaw indicates an expected call of NewRaw.

func (*MockBunIDBMockRecorder) NewSelect

func (mr *MockBunIDBMockRecorder) NewSelect() *gomock.Call

NewSelect indicates an expected call of NewSelect.

func (*MockBunIDBMockRecorder) NewTruncateTable

func (mr *MockBunIDBMockRecorder) NewTruncateTable() *gomock.Call

NewTruncateTable indicates an expected call of NewTruncateTable.

func (*MockBunIDBMockRecorder) NewUpdate

func (mr *MockBunIDBMockRecorder) NewUpdate() *gomock.Call

NewUpdate indicates an expected call of NewUpdate.

func (*MockBunIDBMockRecorder) NewValues

func (mr *MockBunIDBMockRecorder) NewValues(model interface{}) *gomock.Call

NewValues indicates an expected call of NewValues.

func (*MockBunIDBMockRecorder) QueryContext

func (mr *MockBunIDBMockRecorder) QueryContext(ctx, query interface{}, args ...interface{}) *gomock.Call

QueryContext indicates an expected call of QueryContext.

func (*MockBunIDBMockRecorder) QueryRowContext

func (mr *MockBunIDBMockRecorder) QueryRowContext(ctx, query interface{}, args ...interface{}) *gomock.Call

QueryRowContext indicates an expected call of QueryRowContext.

func (*MockBunIDBMockRecorder) RunInTx

func (mr *MockBunIDBMockRecorder) RunInTx(ctx, opts, f interface{}) *gomock.Call

RunInTx indicates an expected call of RunInTx.

type MockConsumerGroupSession

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

MockConsumerGroupSession is a mock of ConsumerGroupSession interface.

func NewMockConsumerGroupSession

func NewMockConsumerGroupSession(ctrl *gomock.Controller) *MockConsumerGroupSession

NewMockConsumerGroupSession creates a new mock instance.

func (*MockConsumerGroupSession) Claims

func (m *MockConsumerGroupSession) Claims() map[string][]int32

Claims mocks base method.

func (*MockConsumerGroupSession) Commit

func (m *MockConsumerGroupSession) Commit()

Commit mocks base method.

func (*MockConsumerGroupSession) Context

Context mocks base method.

func (*MockConsumerGroupSession) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockConsumerGroupSession) GenerationID

func (m *MockConsumerGroupSession) GenerationID() int32

GenerationID mocks base method.

func (*MockConsumerGroupSession) MarkMessage

func (m *MockConsumerGroupSession) MarkMessage(msg *sarama.ConsumerMessage, metadata string)

MarkMessage mocks base method.

func (*MockConsumerGroupSession) MarkOffset

func (m *MockConsumerGroupSession) MarkOffset(topic string, partition int32, offset int64, metadata string)

MarkOffset mocks base method.

func (*MockConsumerGroupSession) MemberID

func (m *MockConsumerGroupSession) MemberID() string

MemberID mocks base method.

func (*MockConsumerGroupSession) ResetOffset

func (m *MockConsumerGroupSession) ResetOffset(topic string, partition int32, offset int64, metadata string)

ResetOffset mocks base method.

type MockConsumerGroupSessionMockRecorder

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

MockConsumerGroupSessionMockRecorder is the mock recorder for MockConsumerGroupSession.

func (*MockConsumerGroupSessionMockRecorder) Claims

Claims indicates an expected call of Claims.

func (*MockConsumerGroupSessionMockRecorder) Commit

Commit indicates an expected call of Commit.

func (*MockConsumerGroupSessionMockRecorder) Context

Context indicates an expected call of Context.

func (*MockConsumerGroupSessionMockRecorder) GenerationID

func (mr *MockConsumerGroupSessionMockRecorder) GenerationID() *gomock.Call

GenerationID indicates an expected call of GenerationID.

func (*MockConsumerGroupSessionMockRecorder) MarkMessage

func (mr *MockConsumerGroupSessionMockRecorder) MarkMessage(msg, metadata interface{}) *gomock.Call

MarkMessage indicates an expected call of MarkMessage.

func (*MockConsumerGroupSessionMockRecorder) MarkOffset

func (mr *MockConsumerGroupSessionMockRecorder) MarkOffset(topic, partition, offset, metadata interface{}) *gomock.Call

MarkOffset indicates an expected call of MarkOffset.

func (*MockConsumerGroupSessionMockRecorder) MemberID

MemberID indicates an expected call of MemberID.

func (*MockConsumerGroupSessionMockRecorder) ResetOffset

func (mr *MockConsumerGroupSessionMockRecorder) ResetOffset(topic, partition, offset, metadata interface{}) *gomock.Call

ResetOffset indicates an expected call of ResetOffset.

type SqliteBunConnection

type SqliteBunConnection[T any] struct {
	FixtureFolder string
	FixtureFile   string
	// contains filtered or unexported fields
}

func (*SqliteBunConnection[T]) Db

func (r *SqliteBunConnection[T]) Db() bun.IDB

func (*SqliteBunConnection[T]) Start

func (r *SqliteBunConnection[T]) Start() error

func (*SqliteBunConnection[T]) Stop

func (r *SqliteBunConnection[T]) Stop()

type StringJson

type StringJson struct {
	Message string
}

type TestContainerLogging

type TestContainerLogging struct {
}

func (TestContainerLogging) Printf

func (TestContainerLogging) Printf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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