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 ¶
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.