testrunner

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkipTest = &skipTestError{msg: "Test skipped"}

Functions

func Attribute

func Attribute[V any](
	context Context, key string, value V,
)

func GetAttribute

func GetAttribute[V any](
	context Context, key string,
) V

func WithPostgresVersionCheck added in v0.12.0

func WithPostgresVersionCheck(
	version version.PostgresVersion,
) testConfigurator

func WithSetup

func WithSetup(
	fn func(ctx SetupContext) error,
) testConfigurator

func WithTearDown

func WithTearDown(
	fn func(ctx Context) error,
) testConfigurator

func WithTimescaleVersionCheck added in v0.12.0

func WithTimescaleVersionCheck(
	version version.TimescaleVersion,
) testConfigurator

Types

type ContainerLogForwarder

type ContainerLogForwarder struct {
	Logger *logging.Logger
}

func (*ContainerLogForwarder) Accept

func (c *ContainerLogForwarder) Accept(
	log testcontainers.Log,
)

type Context

type Context interface {
	PrivilegedContext
	PrivilegedContext(
		fn func(context PrivilegedContext) error,
	) error
	CreateHypertable(
		timeDimension string, chunkSize time.Duration, columns ...inttest.Column,
	) (string, string, error)
	CreateVanillaTable(
		columns ...inttest.Column,
	) (string, string, error)
	PauseReplicator() error
	ResumeReplicator() error
	PostgresqlVersion() version.PostgresVersion
	TimescaleVersion() version.TimescaleVersion
	// contains filtered or unexported methods
}

type PrivilegedContext

type PrivilegedContext interface {
	Exec(
		ctx context.Context, sql string, arguments ...any,
	) (pgconn.CommandTag, error)
	Query(
		ctx context.Context, sql string, args ...any,
	) (pgx.Rows, error)
	QueryRow(
		ctx context.Context, sql string, args ...any,
	) pgx.Row
	SendBatch(
		context.Context, *pgx.Batch,
	) pgx.BatchResults
	CopyFrom(
		context.Context, pgx.Identifier, []string, pgx.CopyFromSource,
	) (int64, error)
	Begin(
		ctx context.Context,
	) (pgx.Tx, error)
	BeginTx(
		ctx context.Context, txOptions pgx.TxOptions,
	) (pgx.Tx, error)
	Ping(
		ctx context.Context,
	) error
}

type SetupContext

type SetupContext interface {
	Context
	AddSystemConfigConfigurator(
		fn func(config *sysconfig.SystemConfig),
	)
}

type TestRunner

type TestRunner struct {
	suite.Suite
	// contains filtered or unexported fields
}

func (*TestRunner) RunTest

func (tr *TestRunner) RunTest(
	testFn func(context Context) error, configurators ...testConfigurator,
)

func (*TestRunner) SetupSuite

func (tr *TestRunner) SetupSuite()

func (*TestRunner) TearDownSuite

func (tr *TestRunner) TearDownSuite()

Jump to

Keyboard shortcuts

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