workflowtest

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 21 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.

README

Durable Workflow test helpers

StartDevServer(t) starts a copy of the published dw development runtime. Each test gets a free loopback port, its own SQLite data directory, and a fresh credential passed to the CLI on standard input. The helper waits for /api/ready and stops the process during test cleanup.

server := workflowtest.StartDevServer(t)
cfg := client.Config{Endpoint: server.Endpoint(), Token: server.Token()}

Use server.ExportHistory(ctx, handle.WorkflowID, handle.RunID) to capture the selected run as a Native v2 history bundle. The bundle limit is 64 MiB.

The first use downloads the platform executable for CLI 2.16.0 from its GitHub release. The helper checks length and SHA-256 before caching the file and verifies it again on each use. The cache lives under durable-workflow/sdk-go/cli/2.16.0 in the OS user cache directory. It can be populated ahead of time with the original release executable. Supported platforms match the published assets for Linux and macOS amd64 and arm64, and Windows amd64.

Run go test -race ./... from this directory. The tests use local fixtures. Run DW_TEST_DEV_SERVER=1 go test -race ./... to include a live check of the pinned binary with the published Go SDK preview v0.1.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevServer

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

DevServer is a test-owned, loopback Durable Workflow runtime.

func StartDevServer

func StartDevServer(t testing.TB) *DevServer

StartDevServer starts the pinned dw release on a free loopback port and waits for readiness. It downloads the verified binary on first use and registers process and data-directory cleanup with t.

func (*DevServer) Endpoint

func (s *DevServer) Endpoint() string

Endpoint returns the loopback URL to use in SDK configuration.

func (*DevServer) ExportHistory

func (s *DevServer) ExportHistory(ctx context.Context, workflowID, runID string) ([]byte, error)

ExportHistory returns the version-2 history bundle for a selected run.

func (*DevServer) Token

func (s *DevServer) Token() string

Token returns the credential for this test's dev server.

Jump to

Keyboard shortcuts

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