luci: go.chromium.org/luci/server/tq/internal/testutil Index | Files

package testutil

import "go.chromium.org/luci/server/tq/internal/testutil"

Package testutil provides fakes for testing TQ guts.

Index

Package Files

db.mock.go dbtest.go doc.go fakedb.go gen.go

func RunDBAcceptance Uses

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.

type FakeDB Uses

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

FakeDB implements Database in RAM.

func (*FakeDB) AllReminders Uses

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

AllReminders returns all currently saved reminders.

func (*FakeDB) Defer Uses

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

func (*FakeDB) DeleteReminder Uses

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

func (*FakeDB) ExecDefers Uses

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

ExecDefers executes all registered defers in reverse order.

func (*FakeDB) FetchReminderRawPayloads Uses

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

func (*FakeDB) FetchRemindersMeta Uses

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

func (*FakeDB) Inject Uses

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

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

func (*FakeDB) Kind Uses

func (f *FakeDB) Kind() string

func (*FakeDB) SaveReminder Uses

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

type MockDB Uses

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

MockDB is a mock of DB interface.

func NewMockDB Uses

func NewMockDB(ctrl *gomock.Controller) *MockDB

NewMockDB creates a new mock instance.

func (*MockDB) Defer Uses

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

Defer mocks base method.

func (*MockDB) DeleteReminder Uses

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

DeleteReminder mocks base method.

func (*MockDB) EXPECT Uses

func (m *MockDB) EXPECT() *MockDBMockRecorder

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

func (*MockDB) FetchReminderRawPayloads Uses

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

FetchReminderRawPayloads mocks base method.

func (*MockDB) FetchRemindersMeta Uses

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

FetchRemindersMeta mocks base method.

func (*MockDB) Kind Uses

func (m *MockDB) Kind() string

Kind mocks base method.

func (*MockDB) SaveReminder Uses

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

SaveReminder mocks base method.

type MockDBMockRecorder Uses

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

MockDBMockRecorder is the mock recorder for MockDB.

func (*MockDBMockRecorder) Defer Uses

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

Defer indicates an expected call of Defer.

func (*MockDBMockRecorder) DeleteReminder Uses

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

DeleteReminder indicates an expected call of DeleteReminder.

func (*MockDBMockRecorder) FetchReminderRawPayloads Uses

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

FetchReminderRawPayloads indicates an expected call of FetchReminderRawPayloads.

func (*MockDBMockRecorder) FetchRemindersMeta Uses

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

FetchRemindersMeta indicates an expected call of FetchRemindersMeta.

func (*MockDBMockRecorder) Kind Uses

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

Kind indicates an expected call of Kind.

func (*MockDBMockRecorder) SaveReminder Uses

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

SaveReminder indicates an expected call of SaveReminder.

Package testutil imports 11 packages (graph). Updated 2020-09-30. Refresh now. Tools for package owners.