testutil

package
v0.0.0-...-128afb8 Latest Latest
Warning

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

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

Documentation

Overview

Package testutil provides fakes for testing TQ guts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunDBAcceptance

func RunDBAcceptance(ctx context.Context, db db.DB, t *testing.T)

RunDBAcceptance tests a database implementation.

Sadly, GoConvey-reported error lines are borked because it doesn't search stack in files other than "*_test.go" and "*_tests.go", which this file can't be as it is in a different package. However, you can run tests for your database via $ go test and examine stacktraces for actual true line nimber. Or, you can copy this file to your package during debugging.

Types

type FakeDB

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

FakeDB implements Database in RAM.

func (*FakeDB) AllReminders

func (f *FakeDB) AllReminders() []*reminder.Reminder

AllReminders returns all currently saved reminders.

func (*FakeDB) Defer

func (f *FakeDB) Defer(_ context.Context, cb func(context.Context))

func (*FakeDB) DeleteReminder

func (f *FakeDB) DeleteReminder(_ context.Context, r *reminder.Reminder) error

func (*FakeDB) ExecDefers

func (f *FakeDB) ExecDefers(ctx context.Context)

ExecDefers executes all registered defers in reverse order.

func (*FakeDB) FetchReminderRawPayloads

func (f *FakeDB) FetchReminderRawPayloads(_ context.Context, in []*reminder.Reminder) (out []*reminder.Reminder, err error)

func (*FakeDB) FetchRemindersMeta

func (f *FakeDB) FetchRemindersMeta(ctx context.Context, low, high string, limit int) ([]*reminder.Reminder, error)

func (*FakeDB) Inject

func (f *FakeDB) Inject(ctx context.Context) context.Context

Inject inserts `f` into the context to make it transactional.

func (*FakeDB) Kind

func (f *FakeDB) Kind() string

func (*FakeDB) SaveReminder

func (f *FakeDB) SaveReminder(_ context.Context, r *reminder.Reminder) error

type MockDB

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

MockDB is a mock of DB interface.

func NewMockDB

func NewMockDB(ctrl *gomock.Controller) *MockDB

NewMockDB creates a new mock instance.

func (*MockDB) Defer

func (m *MockDB) Defer(arg0 context.Context, arg1 func(context.Context))

Defer mocks base method.

func (*MockDB) DeleteReminder

func (m *MockDB) DeleteReminder(arg0 context.Context, arg1 *reminder.Reminder) error

DeleteReminder mocks base method.

func (*MockDB) EXPECT

func (m *MockDB) EXPECT() *MockDBMockRecorder

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

func (*MockDB) FetchReminderRawPayloads

func (m *MockDB) FetchReminderRawPayloads(arg0 context.Context, arg1 []*reminder.Reminder) ([]*reminder.Reminder, error)

FetchReminderRawPayloads mocks base method.

func (*MockDB) FetchRemindersMeta

func (m *MockDB) FetchRemindersMeta(ctx context.Context, low, high string, limit int) ([]*reminder.Reminder, error)

FetchRemindersMeta mocks base method.

func (*MockDB) Kind

func (m *MockDB) Kind() string

Kind mocks base method.

func (*MockDB) SaveReminder

func (m *MockDB) SaveReminder(arg0 context.Context, arg1 *reminder.Reminder) error

SaveReminder mocks base method.

type MockDBMockRecorder

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

MockDBMockRecorder is the mock recorder for MockDB.

func (*MockDBMockRecorder) Defer

func (mr *MockDBMockRecorder) Defer(arg0, arg1 interface{}) *gomock.Call

Defer indicates an expected call of Defer.

func (*MockDBMockRecorder) DeleteReminder

func (mr *MockDBMockRecorder) DeleteReminder(arg0, arg1 interface{}) *gomock.Call

DeleteReminder indicates an expected call of DeleteReminder.

func (*MockDBMockRecorder) FetchReminderRawPayloads

func (mr *MockDBMockRecorder) FetchReminderRawPayloads(arg0, arg1 interface{}) *gomock.Call

FetchReminderRawPayloads indicates an expected call of FetchReminderRawPayloads.

func (*MockDBMockRecorder) FetchRemindersMeta

func (mr *MockDBMockRecorder) FetchRemindersMeta(ctx, low, high, limit interface{}) *gomock.Call

FetchRemindersMeta indicates an expected call of FetchRemindersMeta.

func (*MockDBMockRecorder) Kind

func (mr *MockDBMockRecorder) Kind() *gomock.Call

Kind indicates an expected call of Kind.

func (*MockDBMockRecorder) SaveReminder

func (mr *MockDBMockRecorder) SaveReminder(arg0, arg1 interface{}) *gomock.Call

SaveReminder indicates an expected call of SaveReminder.

Jump to

Keyboard shortcuts

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