testing

package
v2.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApplication

func CreateApplication[TServer, TContainer any](t testing.TB, creater AppCreater[TServer, TContainer], configName ...string) (TServer, TContainer)

func CreateApplicationFunc

func CreateApplicationFunc[TServer, TContainer any](t testing.TB, creater AppCreaterFunc[TServer, TContainer]) (TServer, TContainer)

func CreateMongoDBWithDBName

func CreateMongoDBWithDBName(t testing.TB, optMaker MongoOptions) (*mongo.Client, string)

func CreateMySQL

func CreateMySQL(t testing.TB, optMaker MySQLOptions) (*sql.DB, string)

func CreateScyllaDB

func CreateScyllaDB(t testing.TB, optMaker ScyllaDBOptions) *gocql.Session

func CreateTimescaledb

func CreateTimescaledb(t testing.TB, optMaker TimescaledbOptions) (*sql.DB, string)

func FindConfig

func FindConfig(t testing.TB, configName ...string) string

func FindFile

func FindFile(t testing.TB, fileName string) string

func GetConfig

func GetConfig[T any](t testing.TB, create func(*viper.Viper) (T, error)) T

func NewAppTestLogger

func NewAppTestLogger(t testing.TB, level zerolog.Level) (zerolog.Logger, *zltest.Tester)

func ProjectRootDir

func ProjectRootDir(t testing.TB) string

func Timeout

func Timeout(t testing.TB, timeout time.Duration) context.Context

func WorkingDir

func WorkingDir(t testing.TB) string

Types

type AppCreater

type AppCreater[TServer, TContainer any] interface {
	Create(context.Context, *viper.Viper) (TServer, TContainer)
}

type AppCreaterFunc

type AppCreaterFunc[TServer, TContainer any] func(context.Context, *viper.Viper) (TServer, TContainer)

func (AppCreaterFunc[TServer, TContainer]) Create

func (h AppCreaterFunc[TServer, TContainer]) Create(ctx context.Context, config *viper.Viper) (TServer, TContainer)

type MongoOptions

type MongoOptions interface {
	GetOptions() *options.ClientOptions
}

type MySQLOptions

type MySQLOptions interface {
	GetOptions() MySQLOptionsData
}

type MySQLOptionsData

type MySQLOptionsData struct {
	RootUser      string
	RootPass      string
	Host          string
	Net           string
	DB            string
	User          string
	Password      string
	MigrationFile string
}

type ScyllaDBOptions

type ScyllaDBOptions interface {
	GetOptions() *gocql.ClusterConfig
}

type TimescaledbOptions

type TimescaledbOptions interface {
	GetOptions() TimescaledbptionsData
}

type TimescaledbptionsData

type TimescaledbptionsData struct {
	Host          string
	Username      string
	Password      string
	DB            string
	Schema        string
	SSLMode       string
	Port          int
	MigrationFile string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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