tester

package
v0.15.0 Latest Latest
Warning

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

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

Documentation

Overview

Package tester is a generic testing package with helpful methods for all packages

Index

Constants

This section is empty.

Variables

View Source
var ErrAppNameRequired = errors.New("app name is required")

ErrAppNameRequired is when the app name is required

View Source
var ErrFailedLoadingPostgresql = errors.New("failed loading postgresql server")

ErrFailedLoadingPostgresql is when loading postgresql failed

Functions

func CreateMongoServer

func CreateMongoServer(version string) (*memongo.Server, error)

CreateMongoServer will create a new mongo server

func CreateMySQL

func CreateMySQL(host, databaseName, _, _ string, port uint32) (*server.Server, error)

CreateMySQL will make a new MySQL server NOTE: not using username, password anymore since the mysql package removed "auth"

func CreateMySQLTestDatabase

func CreateMySQLTestDatabase(databaseName string) *memory.Database

CreateMySQLTestDatabase is a dummy database for MySQL

func CreatePostgresServer

func CreatePostgresServer(port uint32) (*embeddedPostgres.EmbeddedPostgres, error)

CreatePostgresServer will create a new Postgresql server

func GetNewRelicApp

func GetNewRelicApp(appName string) (*newrelic.Application, error)

GetNewRelicApp will return a dummy new relic app

func GetNewRelicCtx

func GetNewRelicCtx(t *testing.T, appName, txnName string) context.Context

GetNewRelicCtx will return a dummy ctx

func LoadMockRedis

func LoadMockRedis(
	idleTimeout time.Duration,
	maxConnTime time.Duration,
	maxActive int,
	maxIdle int,
) (client *cache.Client, conn *redigomock.Conn)

LoadMockRedis will load a mocked redis connection

func LoadRealRedis

func LoadRealRedis(
	connectionURL string,
	idleTimeout time.Duration,
	maxConnTime time.Duration,
	maxActive int,
	maxIdle int,
	dependency bool,
	newRelic bool,
) (client *cache.Client, conn redis.Conn, err error)

LoadRealRedis will load a real redis connection

func PaymailMockClient

func PaymailMockClient(domainNames []string) (paymail.ClientInterface, error)

PaymailMockClient will return a client for testing purposes

func RandomTablePrefix

func RandomTablePrefix() string

RandomTablePrefix will make a random prefix (avoid same tables for parallel tests)

func SQLiteTestConfig

func SQLiteTestConfig(debug, shared bool) *datastore.SQLiteConfig

SQLiteTestConfig will return a test-version of SQLite

Types

type AnyGUID

type AnyGUID struct{}

AnyGUID will fill the need for any GUID field

func (AnyGUID) Match

func (a AnyGUID) Match(v driver.Value) bool

Match satisfies sqlmock.Argument interface

type AnyTime

type AnyTime struct{}

AnyTime will fill the need for any timestamp field

func (AnyTime) Match

func (a AnyTime) Match(v driver.Value) bool

Match satisfies sqlmock.Argument interface

Jump to

Keyboard shortcuts

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