testsuite

package
v0.0.0-...-266fb8d Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 22 Imported by: 0

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

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

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

Temporal CLI based DevServer

func StartDevServer

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

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

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

func (*DevServer) FrontendHostPort

func (s *DevServer) FrontendHostPort() string

FrontendHostPort returns the host:port for this server.

func (*DevServer) Stop

func (s *DevServer) Stop() error

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

type DevServerOptions

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
}

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