testsuite

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 22 Imported by: 25

Documentation

Overview

The MIT License

Copyright (c) 2022 Temporal Technologies Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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
}

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