enginetest

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package enginetest provides reusable behavioral tests for workflow engines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunConformance

func RunConformance(t *testing.T, factory Factory)

RunConformance checks the Engine and WorkflowContext behavioral contract. Unsupported capabilities are visible skips. Executable known gaps must reproduce a behavioral failure; a fixed gap fails the test until it is removed from Factory.KnownGaps. Missing lifecycle or inspection hooks fail rather than silently passing a test.

Types

type Factory

type Factory struct {
	New       func(t *testing.T) Fixture
	Durable   bool
	Retries   bool
	KnownGaps map[string]string
}

Factory describes an adapter's capabilities and builds an isolated fixture for each scenario. New must arrange cleanup through t.Cleanup. KnownGaps keys are exact scenario names; gaps must return GapError. Values explain the semantic defect and follow-up.

type Fixture

type Fixture struct {
	Engine        engine.Engine
	TaskQueue     string
	ActivityQueue string
	// Restart stops all old workers, creates a fresh engine on the same backend,
	// invokes register on it, and activates registration before returning.
	// Previously returned handles must remain usable (keep their backend client live).
	Restart func(t *testing.T, register func(engine.Engine)) engine.Engine
	// VerifyActivityOptions checks actual scheduled options, in invocation order.
	// It must inspect backend observations, not the values passed to registration.
	// Observed behavioral differences should return *GapError; backend errors
	// remain ordinary errors and cannot satisfy KnownGaps.
	VerifyActivityOptions func(t *testing.T, workflowID, activity string, want []engine.ActivityOptions) error
	// contains filtered or unexported fields
}

Fixture owns one fresh engine and its backend lifecycle. Backend-specific inspection stays in these hooks; conformance workflows use only engine APIs.

type GapError

type GapError struct {
	Err error
}

GapError reports an observed behavioral difference from the engine contract. Only this error type can satisfy an executable Factory.KnownGaps entry. Deadlines, cancellations and expired scenario contexts always fail the test.

func (*GapError) Error

func (e *GapError) Error() string

Error describes the observed behavioral difference.

func (*GapError) Unwrap

func (e *GapError) Unwrap() error

Unwrap preserves the underlying error, including deadline or cancellation errors.

Jump to

Keyboard shortcuts

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