testutil

package
v0.0.0-...-08b9edc Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableDebugLog

func EnableDebugLog()

func GetHTTPServerHost

func GetHTTPServerHost(server *httptest.Server) string

func NewHTTPServer

func NewHTTPServer(response string) *httptest.Server

func NewHTTPServerAtHost

func NewHTTPServerAtHost(response string, host string) *httptest.Server

func RequireIndexRangeScan

func RequireIndexRangeScan(t *testing.T, explain []ExplainRow)

func TestMain

func TestMain(m *testing.M)

Types

type ExplainRow

type ExplainRow struct {
	ID string `gorm:"column:id"`
}

type MultiServerHelper

type MultiServerHelper struct {
	Servers []*httptest.Server
	// contains filtered or unexported fields
}

func NewMultiServer

func NewMultiServer(n int, responsePattern string) *MultiServerHelper

func (*MultiServerHelper) CloseAll

func (m *MultiServerHelper) CloseAll()

func (*MultiServerHelper) GetEndpoints

func (m *MultiServerHelper) GetEndpoints() []string

func (*MultiServerHelper) LastId

func (m *MultiServerHelper) LastId() int

func (*MultiServerHelper) LastResp

func (m *MultiServerHelper) LastResp() string

type TestDB

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

func OpenMockDB

func OpenMockDB(t *testing.T, configModifier ...func(*gorm.Config)) *TestDB

func OpenTestDB

func OpenTestDB(t *testing.T, configModifier ...func(*mysqldriver.Config, *gorm.Config)) *TestDB

func (*TestDB) Gorm

func (db *TestDB) Gorm() *gorm.DB

func (*TestDB) Mocker

func (db *TestDB) Mocker() sqlmock.Sqlmock

func (*TestDB) MustClose

func (db *TestDB) MustClose()

func (*TestDB) MustExec

func (db *TestDB) MustExec(sql string, values ...interface{})

func (*TestDB) MustExplain

func (db *TestDB) MustExplain(sql string, values ...interface{}) []ExplainRow

func (*TestDB) MustMeetMockExpectation

func (db *TestDB) MustMeetMockExpectation()

func (*TestDB) NewID

func (db *TestDB) NewID() string

Jump to

Keyboard shortcuts

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