testsuite

package
v4.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testsuite provides the shared adapter contracts. Only tests import it.

Index

Constants

View Source
const TimeZone = "America/Toronto"

Variables

View Source
var Profiles = map[string]Profile{
	"postgresql": {SpecificTests: 17}, "cockroachdb": {SpecificTests: 13}, "mysql": {SpecificTests: 3}, "sqlite": {SpecificTests: 3},
	"ql":    {RecordExclusion: "known coverage gap: QL Record fixtures are not implemented"},
	"mssql": {RecordExclusion: "known coverage gap: MSSQL Record suite remains disabled"},
	"mongo": {SQLExclusion: "unsupported: MongoDB has no SQL builder", RecordExclusion: "known coverage gap: MongoDB Record suite remains disabled"},
}
View Source
var Targets = []Target{
	{"postgresql-17", "postgresql", "17"},
	{"postgresql-16", "postgresql", "16"},
	{"postgresql-15", "postgresql", "15"},
	{"mysql-latest", "mysql", "latest"},
	{"mysql-lts", "mysql", "lts"},
	{"mysql-5", "mysql", "5"},
	{"cockroachdb-v23", "cockroachdb", "v23.2.6"},
	{"cockroachdb-v22", "cockroachdb", "v22.2.19"},
	{"mssql-2022", "mssql", "2022-latest"},
	{"mssql-2019", "mssql", "2019-latest"},
	{"mongodb-8", "mongo", "8"},
	{"mongodb-7", "mongo", "7"},
}

Targets is the sole database-version registry, consumed by the runner and Ansible. Slice order also makes test discovery and execution deterministic.

Functions

func Accounts

func Accounts(sess db.Session) db.Store

func Run added in v4.10.2

func Run(t *testing.T, helper Helper, extra suite.TestingSuite)

Run runs the applicable common contracts, then any adapter-local regressions.

Types

type Account

type Account struct {
	ID        uint64     `db:"id,omitempty"`
	Name      string     `db:"name"`
	Disabled  bool       `db:"disabled"`
	CreatedAt *time.Time `db:"created_at,omitempty"`
}

func (*Account) AfterCreate

func (account *Account) AfterCreate(sess db.Session) error

func (*Account) Store

func (*Account) Store(sess db.Session) db.Store

type AccountsStore

type AccountsStore struct {
	db.Collection
}

type GenericTestSuite

type GenericTestSuite struct {
	Suite
}

func (*GenericTestSuite) TestComparisonOperators

func (s *GenericTestSuite) TestComparisonOperators()

func (*GenericTestSuite) TestDatesAndUnicode

func (s *GenericTestSuite) TestDatesAndUnicode()

func (*GenericTestSuite) TestExplicitAndDefaultMapping

func (s *GenericTestSuite) TestExplicitAndDefaultMapping()

func (*GenericTestSuite) TestFibonacci

func (s *GenericTestSuite) TestFibonacci()

func (*GenericTestSuite) TestOddEven

func (s *GenericTestSuite) TestOddEven()

type Helper

type Helper interface {
	Session() db.Session
	Adapter() string
	SetUp() error
	TearDown() error
}

type Log

type Log struct {
	ID      uint64 `db:"id,omitempty"`
	Message string `db:"message"`
}

func (*Log) Store

func (*Log) Store(sess db.Session) db.Store

type LogsStore

type LogsStore struct {
	db.Collection
}

func Logs

func Logs(sess db.Session) *LogsStore

type Profile added in v4.10.2

type Profile struct {
	SpecificTests   int
	SQLExclusion    string
	RecordExclusion string
}

Exclusions explain either an unsupported contract or a known coverage gap. A coverage gap is not a declaration that the database lacks the capability.

type RecordTestSuite

type RecordTestSuite struct {
	Suite
}

func (*RecordTestSuite) BeforeTest

func (s *RecordTestSuite) BeforeTest(suiteName, testName string)

func (*RecordTestSuite) TestAccounts

func (s *RecordTestSuite) TestAccounts()

func (*RecordTestSuite) TestContextCanceled added in v4.5.2

func (s *RecordTestSuite) TestContextCanceled()

func (*RecordTestSuite) TestDelete

func (s *RecordTestSuite) TestDelete()

func (*RecordTestSuite) TestFindOne

func (s *RecordTestSuite) TestFindOne()

func (*RecordTestSuite) TestInheritedTx

func (s *RecordTestSuite) TestInheritedTx()

func (*RecordTestSuite) TestSelectOnlyIDs

func (s *RecordTestSuite) TestSelectOnlyIDs()

func (*RecordTestSuite) TestSlices

func (s *RecordTestSuite) TestSlices()

func (*RecordTestSuite) TestTx

func (s *RecordTestSuite) TestTx()

func (*RecordTestSuite) TestUnknownCollection

func (s *RecordTestSuite) TestUnknownCollection()

type SQLTestSuite

type SQLTestSuite struct {
	Suite
}

func (*SQLTestSuite) BeforeTest

func (s *SQLTestSuite) BeforeTest(suiteName, testName string)

func (*SQLTestSuite) TestBatchInsert

func (s *SQLTestSuite) TestBatchInsert()

func (*SQLTestSuite) TestBatchInsertNoColumns

func (s *SQLTestSuite) TestBatchInsertNoColumns()

func (*SQLTestSuite) TestBatchInsertReturningKeys

func (s *SQLTestSuite) TestBatchInsertReturningKeys()

func (*SQLTestSuite) TestCompositeKeys

func (s *SQLTestSuite) TestCompositeKeys()

func (*SQLTestSuite) TestCustomType

func (s *SQLTestSuite) TestCustomType()

func (*SQLTestSuite) TestDataTypes

func (s *SQLTestSuite) TestDataTypes()

func (*SQLTestSuite) TestExhaustConnectionPool

func (s *SQLTestSuite) TestExhaustConnectionPool()

func (*SQLTestSuite) TestExpectCursorError

func (s *SQLTestSuite) TestExpectCursorError()

func (*SQLTestSuite) TestFunction

func (s *SQLTestSuite) TestFunction()

func (*SQLTestSuite) TestGetAllResults

func (s *SQLTestSuite) TestGetAllResults()

func (*SQLTestSuite) TestGetOneResult

func (s *SQLTestSuite) TestGetOneResult()

func (*SQLTestSuite) TestGetResultsOneByOne

func (s *SQLTestSuite) TestGetResultsOneByOne()

func (*SQLTestSuite) TestGetWithOffset

func (s *SQLTestSuite) TestGetWithOffset()

func (*SQLTestSuite) TestGroup

func (s *SQLTestSuite) TestGroup()

func (*SQLTestSuite) TestInlineStructs

func (s *SQLTestSuite) TestInlineStructs()

func (*SQLTestSuite) TestInsertAndDelete

func (s *SQLTestSuite) TestInsertAndDelete()

func (*SQLTestSuite) TestInsertDefault

func (s *SQLTestSuite) TestInsertDefault()

func (*SQLTestSuite) TestInsertIntoArtistsTable

func (s *SQLTestSuite) TestInsertIntoArtistsTable()

func (*SQLTestSuite) TestInsertReturning

func (s *SQLTestSuite) TestInsertReturning()

func (*SQLTestSuite) TestInsertReturningWithinTransaction

func (s *SQLTestSuite) TestInsertReturningWithinTransaction()

func (*SQLTestSuite) TestNullableFields

func (s *SQLTestSuite) TestNullableFields()

func (*SQLTestSuite) TestPaginator

func (s *SQLTestSuite) TestPaginator()

func (*SQLTestSuite) TestPaginator_Issue607 added in v4.0.2

func (s *SQLTestSuite) TestPaginator_Issue607()

func (*SQLTestSuite) TestPreparedStatementsCache

func (s *SQLTestSuite) TestPreparedStatementsCache()

func (*SQLTestSuite) TestQueryLogger

func (s *SQLTestSuite) TestQueryLogger()

func (*SQLTestSuite) TestQueryNonExistentCollection

func (s *SQLTestSuite) TestQueryNonExistentCollection()

func (*SQLTestSuite) TestSelectFromSubquery added in v4.5.3

func (s *SQLTestSuite) TestSelectFromSubquery()

func (*SQLTestSuite) TestSession

func (s *SQLTestSuite) TestSession()

func (*SQLTestSuite) TestTransactionsAndRollback

func (s *SQLTestSuite) TestTransactionsAndRollback()

Attempts to test database transactions.

func (*SQLTestSuite) TestTruncateAllCollections

func (s *SQLTestSuite) TestTruncateAllCollections()

func (*SQLTestSuite) TestUpdate

func (s *SQLTestSuite) TestUpdate()

func (*SQLTestSuite) TestUpdateWithNullColumn

func (s *SQLTestSuite) TestUpdateWithNullColumn()

func (*SQLTestSuite) Test_Issue565

func (s *SQLTestSuite) Test_Issue565()

type Suite

type Suite struct {
	suite.Suite
	Helper
}

Suite resets the fixture before each test and closes it even after Fatal/Skip. Testify suites must run serially: each has one current testing.T and session.

func (*Suite) BeforeTest

func (s *Suite) BeforeTest(_, _ string)

type Target added in v4.10.2

type Target struct{ Name, Adapter, Version string }

type User

type User struct {
	ID        uint64 `db:"id,omitempty"`
	AccountID uint64 `db:"account_id"`
	Username  string `db:"username"`
}

func (*User) AfterCreate

func (user *User) AfterCreate(sess db.Session) error

func (*User) Store

func (*User) Store(sess db.Session) db.Store

type UsersStore

type UsersStore struct {
	db.Collection
}

func Users

func Users(sess db.Session) *UsersStore

Jump to

Keyboard shortcuts

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