Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StatusCompleted = helpers.ToRuntimeStatusString(protos.OrchestrationStatus_ORCHESTRATION_STATUS_COMPLETED) StatusFailed = helpers.ToRuntimeStatusString(protos.OrchestrationStatus_ORCHESTRATION_STATUS_FAILED) StatusTerminated = helpers.ToRuntimeStatusString(protos.OrchestrationStatus_ORCHESTRATION_STATUS_TERMINATED) )
Functions ¶
func IsTerminal ¶
IsTerminal reports whether the runtime status is a terminal workflow state.
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.
Click to show internal directories.
Click to hide internal directories.