commontest

package
v1.6.0-depsupgrade Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PostgresDockerArgs starts up an instance of CRDB in order to test
	// Postgres drivers.
	// NOTE: Don't use default CRDB port in case another instance is already
	// running.
	PostgresDockerArgs = "-p 26888:26257 cockroachdb/cockroach:v20.2.4 start-single-node --insecure"

	// PostgresDataSourceName is the string used to connect to CRDB in order to
	// test Postgres drivers.
	PostgresDataSourceName = "postgresql://root@localhost:26888?sslmode=disable"
)

Variables

This section is empty.

Functions

func RunAllTests

func RunAllTests(m *testing.M, driverName, dataSourceName, dockerArgs string)

RunTests is called by other driver-specific test packages (like pgxtest and pqtest) in order to set up the test environment and then run all tests. It registers a copyist driver and starts up a SQL docker instance if in recording mode. It then runs all tests by calling testing.M.Run(), and finally exits the process when complete.

func RunTestDataTypes

func RunTestDataTypes(t *testing.T, driverName, dataSourceName string)

RunTestDataTypes queries data types that are interesting for the SQL driver.

func RunTestFloatLiterals

func RunTestFloatLiterals(t *testing.T, driverName, dataSourceName string)

RunTestFloatLiterals tests the generation of float literal values, with and without fractions and exponents.

func RunTestInsert

func RunTestInsert(t *testing.T, driverName, dataSourceName string)

RunTestInsert inserts a row and ensures that it's been committed.

func RunTestMultiStatement

func RunTestMultiStatement(t *testing.T, driverName, dataSourceName string)

RunTestMultiStatement runs multiple SQL statements in a single Exec/Query operation.

func RunTestQuery

func RunTestQuery(t *testing.T, driverName, dataSourceName string)

RunTestQuery performs operations directly on a DB.

func RunTestSqlx

func RunTestSqlx(t *testing.T, driverName, dataSourceName string)

RunTestSqlx tests usage of the `sqlx` package with copyist.

func RunTestTxns

func RunTestTxns(t *testing.T, driverName, dataSourceName string)

RunTestTxns commits and aborts transactions.

Types

type DataTypes

type DataTypes struct {
	Int              int
	Str, Dec, FltArr string
	TimeZ, Time      time.Time
	Bool             bool
	Bytes            []byte
	Flt              float64
	Uuid             []byte
}

DataTypes contains many interesting data types that can be returned by SQL drivers.

Jump to

Keyboard shortcuts

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