tasktest

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTask

func RunTask[T any](baseContext context.Context, task coretask.Task[T], taskDependencyValues ...TaskDependencyValues) (T, error)

RunTask runs a single task.

func RunTaskWithDependency

func RunTaskWithDependency[T any](baseContext context.Context, mainTask coretask.Task[T], dependencies []coretask.UntypedTask) (T, error)

RunTaskWithDependency runs a task as a graph. Supply the dependencies of the main task to resolve the graph correctly.

func StubTask

func StubTask[T any](mockTarget coretask.Task[T], mockResult T, mockError error) coretask.Task[T]

StubTask wraps a given task to return the constant values given without calling the original task.

func StubTaskFromReferenceID

func StubTaskFromReferenceID[T any](mockTargetReference taskid.TaskReference[T], mockResult T, mockError error) coretask.Task[T]

StubTaskFromReferenceID creates a new test task return the given constant value of its result.

func WithTaskResult

func WithTaskResult[T any](ctx context.Context, taskRef taskid.TaskReference[T], value T) context.Context

WithTaskResult adds task result to the given context. It's for testing a function using coretask.GetTaskResult inside.

Types

type TaskDependencyValues

type TaskDependencyValues interface {
	Register(resultMap *typedmap.TypedMap)
}

func NewTaskDependencyValuePair

func NewTaskDependencyValuePair[T any](key taskid.TaskReference[T], value T) TaskDependencyValues

NewTaskDependencyValuePair returns a new pair of a task reference and its value.

Jump to

Keyboard shortcuts

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