testautocore

package
v19.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HistoryKinds

func HistoryKinds(t *testing.T, pool *pgxpool.Pool, key autocore.WorkflowKey) []string

HistoryKinds returns the workflow's history event kinds (oneof field names, e.g. "signal_received", "workflow_completed") ordered by sequence_id.

func WaitForState

func WaitForState(t *testing.T, pool *pgxpool.Pool, key autocore.WorkflowKey, state persistence.WorkflowExecutionState)

WaitForState polls until the workflow addressed by key reaches the given state. A missing row (ErrNoRows) is treated as "not created yet" and keeps polling; any other query error fails the test immediately.

func WorkflowExecutionState

func WorkflowExecutionState(t *testing.T, pool *pgxpool.Pool, key autocore.WorkflowKey) persistence.WorkflowExecutionState

WorkflowExecutionState returns the current execution state of the workflow.

Types

type AutocorePostgres

type AutocorePostgres struct {
	// contains filtered or unexported fields
}

AutocorePostgres is a Postgres test container preloaded with the autocore central and workflow schema templates. Each WithDBs call clones a fresh pair of logical databases for one test.

func NewContainer

func NewContainer(t testing.TB) *AutocorePostgres

NewContainer starts one Postgres container with the autocore template schemas. Typically called once from a suite's SetupSuite.

func (*AutocorePostgres) WithDBs

func (p *AutocorePostgres) WithDBs(t *testing.T) (central, workflow *pgxpool.Pool)

WithDBs clones a fresh central and workflow database from the templates and returns their pools. Both databases are dropped when the test ends.

type DBs

type DBs struct {
	CentralDSN  string
	WorkflowDSN string
	ShardIDs    []persistence.ShardID
}

DBs holds the reconstructed DSNs and shard IDs produced by Bootstrap.

func Bootstrap

func Bootstrap(t *testing.T, central, workflow *pgxpool.Pool, shardCount int) *DBs

Bootstrap registers the workflow database and shard mappings in the central database, mirroring production registration. The workflow DB worker ensures the shard_lease rows itself at engine startup, so only the central side is seeded here.

Directories

Path Synopsis
Package helper (imported as testautocore_helper) provides low-level SQL assertions and mutations used by autocore tests.
Package helper (imported as testautocore_helper) provides low-level SQL assertions and mutations used by autocore tests.

Jump to

Keyboard shortcuts

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