Help us shape the future of Go! Take the 2026 Go Developer Survey

testbed

package
v0.57.15 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Verbose bool

Verbose controls if we build verbose testbeds.

Functions

func RunSubtest

func RunSubtest(t *testing.T, name string, cb func(t *testing.T, tb *Testbed)) bool

RunSubtest executes t.Run with a sub-test.

Run runs f as a subtest of t called name. It runs f in a separate goroutine and blocks until f returns or calls t.Parallel to become a parallel test. Run reports whether f succeeded (or at least did not fail before calling t.Parallel).

Run may be called simultaneously from multiple goroutines, but all such calls must return before the outer test function for t returns.

func RunTest

func RunTest(t *testing.T, cb func(t *testing.T, tb *Testbed))

RunTest executes a test.

Types

type Option

type Option any

Option is an option passed to NewTestbed.

func WithVerbose

func WithVerbose(verbose bool) Option

WithVerbose sets if the verbose mode should be used.

func WithVolumeConfig

func WithVolumeConfig(conf config.Config) Option

WithVolumeConfig passes a custom volume config to load.

type Testbed

type Testbed struct {
	// Context is the root context.
	Context context.Context
	// Logger is the logger
	Logger *logrus.Entry
	// VolumeController is the test volume controller.
	VolumeController volume.Controller
	// Volume is the test volume.
	Volume volume.Volume
	// BucketId is the id of the test bucket.
	BucketId string
	// StaticResolver is the static resolver.
	StaticResolver *srr.Resolver
	// Bus is the controller bus
	Bus bus.Bus
	// StepFactorySet is the transformer step factory set.
	StepFactorySet *block_transform.StepFactorySet
	// contains filtered or unexported fields
}

Testbed is a constructed testbed.

func NewTestbed

func NewTestbed(ctx context.Context, le *logrus.Entry, opts ...Option) (tb *Testbed, tbErr error)

NewTestbed constructs a new core bus with an attached kvtx in-memory volume, logger, and other core controllers required for a test to function.

func (*Testbed) AddReleaseFunc

func (t *Testbed) AddReleaseFunc(cb func())

AddReleaseFunc adds a function to call when Release() is called.

func (*Testbed) BuildEmptyCursor

func (t *Testbed) BuildEmptyCursor(ctx context.Context) (*bucket_lookup.Cursor, error)

BuildEmptyCursor builds an empty cursor rooted at the volume in the testbed.

func (*Testbed) Release

func (t *Testbed) Release()

Release calls all release functions, newest first. It returns after the testbed volume controller has exited and closed its store, so a test may remove the volume's files afterward.

Jump to

Keyboard shortcuts

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