tester

package
v0.0.0-...-880cb89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CorsoCITests        = "CORSO_CI_TESTS"
	CorsoE2ETests       = "CORSO_E2E_TESTS"
	CorsoLoadTests      = "CORSO_LOAD_TESTS"
	CorsoNightlyTests   = "CORSO_NIGHTLY_TESTS"
	CorsoRetentionTests = "CORSO_RETENTION_TESTS"
)

Flags for declaring which scope of tests to run.

Variables

This section is empty.

Functions

func AreSameFunc

func AreSameFunc(t *testing.T, expect, have any)

AreSameFunc asserts whether the two funcs are the same func.

func AssertEmptyOrEqual

func AssertEmptyOrEqual(
	t *testing.T,
	expect any,
	got any,
	msgAndArgs ...any,
) bool

AssertEmptyOrEqual checks either:

  • got is nil or the zero value if expected is nil
  • expected and got are equal if expected is not nil

func CheckPopulated

func CheckPopulated(input any) error

CheckPopulated returns an error if input is not fully populated. To be considered fully populated it must be non-zero-valued. For basic types this just means it isn't the zero value. For structs this means that every field is not zero-valued. This check is recursive for structs.

func LoadAFile

func LoadAFile(t *testing.T, fileName string) []byte

func LogTimeOfTest

func LogTimeOfTest(t TestT) string

LogTimeOfTest logs the test name and the time that it was run.

func MustGetEnvSets

func MustGetEnvSets(t *testing.T, evs ...[]string) map[string]string

MustGetEnvSls retrieves the provided env vars from the os. Retrieved values are populated into the resulting map. If any of the env values are zero length, the test errors.

func MustGetEnvVars

func MustGetEnvVars(t *testing.T, evs ...string) map[string]string

MustGetEnvVars retrieves the provided env vars from the os. Retrieved values are populated into the resulting map. If any of the env values are zero length, the test errors.

func NewContext

func NewContext(t TestT) (context.Context, func())

func NewE2ESuite

func NewE2ESuite(
	t *testing.T,
	envSets [][]string,
	runOnAnyEnv ...string,
) *e2eSuite

func NewIntegrationSuite

func NewIntegrationSuite(
	t *testing.T,
	envSets [][]string,
	runOnAnyEnv ...string,
) *integrationSuite

func NewLoadSuite

func NewLoadSuite(
	t *testing.T,
	envSets [][]string,
	runOnAnyEnv ...string,
) *loadSuite

func NewNightlySuite

func NewNightlySuite(
	t *testing.T,
	envSets [][]string,
	runOnAnyEnv ...string,
) *nightlySuite

func NewRetentionSuite

func NewRetentionSuite(
	t *testing.T,
	envSets [][]string,
	runOnAnyEnv ...string,
) *retentionSuite

func NewUnitSuite

func NewUnitSuite(t *testing.T) *unitSuite

func NilOrZero

func NilOrZero(input any) bool

NilOrZero return true if the input is nil or if it's the zero value for the type. If the input is a struct then all fields are recursively checked to see if they're the zero value for their type.

func RunOnAny

func RunOnAny(t *testing.T, tests ...string)

RunOnAny takes in a list of env variable names and returns an error if all of them are zero valued. Implication being: if any of those env vars are truthy, you should run the subsequent tests.

func WithContext

func WithContext(
	t TestT,
	ctx context.Context,
) (context.Context, func())

Types

type Suite

type Suite interface {
	suite.TestingSuite
	Run(name string, subtest func()) bool
}

type TestT

type TestT interface {
	Logf(format string, args ...any)
	Name() string
	TempDir() string
	require.TestingT
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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