Help us shape the future of Go! Take the 2026 Go Developer Survey

executionfake

package
v1.0.0-rc.12 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package executionfake is an in-memory TaskDriver for tests of callers. It keeps the contract's identity, lifecycle and refusal rules; it runs no program. A task's output and exit come from its spec's environment: FAKE_OUTPUT, FAKE_EXIT, and FAKE_BLOCK=1 for a task that runs until stopped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tasks

type Tasks struct {
	// Now is the clock an admission's expiry is judged by, as a real driver
	// is given its caller's (AppTown's) clock: a test that moves that clock
	// gives it here. Nil is the system clock.
	Now func() time.Time
	// contains filtered or unexported fields
}

func (*Tasks) AdmissionOf

func (f *Tasks) AdmissionOf(key string) execution.Admission

AdmissionOf is the admission the task under key was ensured with, kept after it is released.

func (*Tasks) Capabilities

func (f *Tasks) Capabilities() execution.Capabilities

func (*Tasks) Ensure

func (*Tasks) Exit

func (f *Tasks) Exit(key string, code int)

Exit ends a running task with code, as its program would.

func (*Tasks) ExitOutOfMemory

func (f *Tasks) ExitOutOfMemory(key string, code int)

ExitOutOfMemory ends a running task as Docker does at its memory limit: killed, with code (which a killed child in a pipeline can leave at 0).

func (*Tasks) Observe

func (*Tasks) Output

func (*Tasks) Present

func (f *Tasks) Present(key string) bool

Present reports whether a task under key exists (it was ensured and not released).

func (*Tasks) Release

func (f *Tasks) Release(_ context.Context, ref execution.TaskRef) error

func (*Tasks) ReleaseWorkspace

func (f *Tasks) ReleaseWorkspace(context.Context, string) error

ReleaseWorkspace: the fake has no workspaces. Behind a worker, the worker keeps them.

func (*Tasks) Start

func (f *Tasks) Start(_ context.Context, ref execution.TaskRef) error

func (*Tasks) Starts

func (f *Tasks) Starts(key string) int

Starts is how many times a task under key was started, counting tasks since released: a test counts executions with it.

func (*Tasks) Stop

func (f *Tasks) Stop(_ context.Context, ref execution.TaskRef) error

func (*Tasks) Wait

func (f *Tasks) Wait(ctx context.Context, ref execution.TaskRef) (int, error)

Jump to

Keyboard shortcuts

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