testsuite

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 22 Imported by: 25

Documentation

Overview

Package testsuite contains unit testing framework for Temporal workflows and activities and a helper to download and start a dev server.

Index

Constants

This section is empty.

Variables

View Source
var ErrMockStartChildWorkflowFailed = internal.ErrMockStartChildWorkflowFailed

ErrMockStartChildWorkflowFailed is special error used to indicate the mocked child workflow should fail to start.

Functions

This section is empty.

Types

type CachedDownload added in v1.21.1

type CachedDownload struct {
	// Which version to download, by default the latest version compatible with the SDK will be downloaded.
	// Acceptable values are specific release versions (e.g v0.3.0), "default", and "latest".
	Version string
	// Destination directory or the user temp directory if unset.
	DestDir string
}

Cached download of the dev server.

type DevServer added in v1.21.1

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

Temporal CLI based DevServer

func StartDevServer added in v1.21.1

func StartDevServer(ctx context.Context, options DevServerOptions) (*DevServer, error)

StartDevServer starts a Temporal CLI dev server process. This may download the server if not already downloaded.

func (*DevServer) Client added in v1.21.1

func (s *DevServer) Client() client.Client

Get a connected client, configured to work with the dev server.

func (*DevServer) FrontendHostPort added in v1.22.0

func (s *DevServer) FrontendHostPort() string

FrontendHostPort returns the host:port for this server.

func (*DevServer) Stop added in v1.21.1

func (s *DevServer) Stop() error

Stop the running server and wait for shutdown to complete. Error is propagated from server shutdown.

type DevServerOptions added in v1.21.1

type DevServerOptions struct {
	// Existing path on the filesystem for the executable.
	ExistingPath string
	// Download the executable if not already there.
	CachedDownload CachedDownload
	// Client options used to create a client for the dev server.
	// The provided Namespace or the "default" namespace is automatically registered on startup.
	// If HostPort is provided, the host and port will be used to bind the server, otherwise the server will bind to
	// localhost and obtain a free port.
	ClientOptions *client.Options
	// SQLite DB filename if persisting or non-persistent if none.
	DBFilename string
	// Whether to enable the UI.
	EnableUI bool
	// Log format - defaults to "pretty".
	LogFormat string
	// Log level - defaults to "warn".
	LogLevel string
	// Additional arguments to the dev server.
	ExtraArgs []string
	// Where to redirect stdout and stderr, if nil they will be redirected to the current process.
	Stdout io.Writer
	Stderr io.Writer
}

Configuration for the dev server.

type MockCallWrapper

type MockCallWrapper = internal.MockCallWrapper

MockCallWrapper is a wrapper to mock.Call. It offers the ability to wait on workflow's clock instead of wall clock.

type TestActivityEnvironment

type TestActivityEnvironment = internal.TestActivityEnvironment

TestActivityEnvironment is the environment that you use to test activity

type TestUpdateCallback added in v1.30.1

type TestUpdateCallback = internal.TestUpdateCallback

TestUpdateCallback is a basic implementation of the UpdateCallbacks interface for testing purposes.

type TestWorkflowEnvironment

type TestWorkflowEnvironment = internal.TestWorkflowEnvironment

TestWorkflowEnvironment is the environment that you use to test workflow

type WorkflowTestSuite

type WorkflowTestSuite = internal.WorkflowTestSuite

WorkflowTestSuite is the test suite to run unit tests for workflow/activity.

Jump to

Keyboard shortcuts

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