test

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverMySQL    = "mysql"
	DriverPostgres = "postgres"
)

Driver names.

Variables

This section is empty.

Functions

func AddSQLFlags added in v0.7.0

func AddSQLFlags(fs *flag.FlagSet, driver, source, sourceAdmin, dbName *string)

AddSQLFlags adds some SQL options to the given flag set.

func CleanupSQLDatastore added in v0.7.0

func CleanupSQLDatastore(t TLogger, driver, source string)

CleanupSQLDatastore empties the tables from the NATS Streaming database.

func CreateSQLDatabase added in v0.7.0

func CreateSQLDatabase(driver, sourceAdmin, source, dbName string) error

CreateSQLDatabase initializes a SQL Database for NATS Streaming testing.

func DeleteSQLDatabase added in v0.7.0

func DeleteSQLDatabase(driver, sourceAdmin, dbName string) error

DeleteSQLDatabase drops the given database.

func MustExecuteSQL added in v0.7.0

func MustExecuteSQL(t TLogger, db *sql.DB, query string, args ...interface{}) sql.Result

MustExecuteSQL excutes the given SQL query and is not expecting an error. If it does, it calls t.Fatalf().

func ProcessSQLFlags added in v0.7.0

func ProcessSQLFlags(fs *flag.FlagSet, defaults map[string][]string) error

ProcessSQLFlags allows to just specify the driver on the command line and use corresponding driver defaults, while still allowing full customization of each param.

func StackFatalf added in v0.7.0

func StackFatalf(t TLogger, f string, args ...interface{})

StackFatalf produces a stack trace and passes it to t.Fatalf()

Types

type TLogger added in v0.7.0

type TLogger interface {
	Fatalf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

TLogger is used both in testing.B and testing.T so need to use a common interface

Jump to

Keyboard shortcuts

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