httpapi

package
v1.18.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func IsTerminal

func IsTerminal(s string) bool

IsTerminal reports whether the runtime status is a terminal workflow state.

func Start

func Start(t *testing.T, ctx context.Context, httpClient *http.Client, httpPort int, workflowName string, input any) string

Start starts the named workflow via the HTTP API and returns the new instance ID. Fails the test on any error.

Types

type Status

type Status struct {
	RuntimeStatus string            `json:"runtimeStatus"`
	Properties    map[string]string `json:"properties"`
}

Status mirrors the JSON the dapr workflow HTTP API returns for a single instance. Only the fields callers care about are decoded.

func Run

func Run(t *testing.T, ctx context.Context, httpClient *http.Client, httpPort int, workflowName string, input any, timeout time.Duration) Status

Run starts the named workflow and waits for it to reach a terminal state. Fails the test on any error via require — top-level test usage:

status := httpapi.Run(t, ctx, httpClient, port, name, input, 30*time.Second)
require.Equal(t, httpapi.StatusCompleted, status.RuntimeStatus)

Inside an assert.EventuallyWithT closure, use TryRun instead — it returns an error so the caller can decide whether to fail the tick.

func TryRun

func TryRun(ctx context.Context, httpClient *http.Client, httpPort int, workflowName string, input any, timeout time.Duration) (Status, error)

TryRun is the error-returning variant of Run. Synchronous polling, no internal goroutines, so it is safe to call from inside an assert.EventuallyWithT closure.

Jump to

Keyboard shortcuts

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