testing

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateApplication

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

Creates a new instance of application for testing purposes

func CreateApplicationFunc

func CreateApplicationFunc[TServer, TContainer any](creater AppCreaterFunc[TServer, TContainer]) (TServer, TContainer)

TODO: Check if it's needed to document this

func CreateMongoDB added in v0.9.1

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

func CreateScyllaDB added in v0.9.1

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

func FindConfig

func FindConfig(workingDir string, configName ...string) (string, error)

Returns directory of config files and error if file doesent exist

func FindFile

func FindFile(workingDir string, fileName string) (string, error)

Returns directory of config file name and error if file doesent exist

func GetConfig added in v0.9.1

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

func NewAppTestLogger

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

Returns new instance of zerolog and *zltest.Tester for testing puurposes

func WorkingDir added in v0.9.1

func WorkingDir(t testing.TB) string

Types

type AppCreater

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

interface AppCreater Retunrs Server and Container for testing purposes

type AppCreaterFunc

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

Delegates functions for AppCreater

func (AppCreaterFunc[TServer, TContainer]) Create

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

TODO: Check if it's needed to document this

type MongoOptions added in v0.9.1

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

type ScyllaDBOptions added in v0.9.1

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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