seqtest

package
v0.0.0-...-1f15b0d Latest Latest
Warning

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

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

Documentation

Overview

Package seqtest provides a test fixture for instantiating sequencers and other general-purpose test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSequencer

func CheckSequencer(
	t *testing.T,
	pre func(t *testing.T, fixture *all.Fixture, seqFixture *Fixture) sequencer.Sequencer,
	post func(t *testing.T, check *Check),
)

CheckSequencer implements a general-purpose smoke test of a sequencer.Sequencer implementation. The sequencer must support foreign-key relationships. The post-hook may be nil.

func Fragment

func Fragment(batch *types.MultiBatch) ([]*types.MultiBatch, error)

Fragment breaks a batch up into a number of minimum-sized batches which are representative of how the bulk-transfer CDC feed delivers data (i.e. payloads per table). The data for any given table will remain in a time-ordered fashion.

Types

type Check

type Check struct {
	// The acceptor returned by [sequencer.Sequencer.Start].
	Acceptor types.MultiAcceptor
	// The total number of transactions to apply.
	Batches int
	// Populated by Check.
	Bounds notify.Var[hlc.Range]
	// Access to test services.
	Fixture *all.Fixture
	// Populated by Check.
	Generator *all.Workload
	// Populated by Check.
	Group *types.TableGroup
	// The Sequencer under test.
	Sequencer sequencer.Sequencer
	// If true, generated data will be loaded into staging first. This
	// is used to validate the sweeping behavior of a sequencer.
	Stage bool
}

Check implements a reusable test over a parent/child table pair.

func (*Check) Check

func (c *Check) Check(ctx *stopper.Context, t testing.TB)

Check generates data and verifies that it reaches the target tables.

type CheckFlag

type CheckFlag int

CheckFlag describes the range of configurations to be tested. See CheckFlags.

func CheckFlags

func CheckFlags() []CheckFlag

CheckFlags returns all check combinations.

func (CheckFlag) String

func (f CheckFlag) String() string

type Fixture

type Fixture struct {
	*all.Fixture

	BestEffort *besteffort.BestEffort
	Chaos      *chaos.Chaos
	Core       *core.Core
	Immediate  *immediate.Immediate
	Retire     *retire.Retire
	Script     *script.Sequencer
	Switcher   *switcher.Switcher
}

Fixture provides ready-to-use instances of sequencer types.

func NewSequencerFixture

func NewSequencerFixture(fixture *all.Fixture, config *sequencer.Config, scriptConfig *script.Config) (*Fixture, error)

func (*Fixture) SequencerFor

func (f *Fixture) SequencerFor(
	ctx *stopper.Context, mode switcher.Mode,
) (sequencer.Sequencer, error)

SequencerFor returns a Sequencer instance that corresponds to the given mode enum.

Jump to

Keyboard shortcuts

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