test

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 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

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

AddSQLFlags adds some SQL options to the given flag set.

func CleanupSQLDatastore

func CleanupSQLDatastore(t TLogger, driver, source string)

CleanupSQLDatastore empties the tables from the NATS Streaming database.

func CreateSQLDatabase

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

CreateSQLDatabase initializes a SQL Database for NATS Streaming testing.

func DeleteSQLDatabase

func DeleteSQLDatabase(driver, sourceAdmin, dbName string) error

DeleteSQLDatabase drops the given database.

func MustExecuteSQL

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

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

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

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

Types

type TLogger

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