Documentation
¶
Overview ¶
Package drivertest provides conformance tests for db implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunConformanceTests ¶
func RunConformanceTests(t *testing.T, newHarness HarnessMaker[*testing.T])
RunConformanceTests runs conformance tests for driver implementations of the driver.DBFactory interface.
Types ¶
type Harness ¶
type Harness interface { // MakeAdapter makes a new adapter for the harness. // Adapter and tx should be considered valid if err is nil. MakeAdapter(context.Context) (adapter driver.DBFactory, tx *gorm.DB, err error) // Close closes resources used by the harness. Close() // Options returns the options for the harness. Options() Options }
Harness descibes the functionality test harnesses must provide to run conformance tests.
type HarnessMaker ¶
HarnessMaker describes functions that construct a harness for running tests. It is called exactly once per test; Harness.Close() will be called when the test is complete.
type Options ¶
type Options struct { // IsMock indicates if the driver is a mock implementation. // This is useful for mock implementations or drivers that do not support // the specific features required by the tests. IsMock bool // MaxConnectionsSQL specifies the SQL query to get the maximum number of connections. MaxConnectionsSQL string }
Options is a set of options to configure driver specific behavior.
Click to show internal directories.
Click to hide internal directories.