testfixture

package
v0.182.5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DirectCIHead = "0123456789012345678901234567890123456789"
View Source
const NotFound = `#!/bin/sh
printf 'HTTP/2.0 404 Not Found\nContent-Type: application/json\n\n{"message":"Not Found"}\n'
exit 1
`

orchCovNotFound is the `gh api --include` shape of an authoritative 404: a status line, headers, and a body, with a non-zero exit status.

View Source
const OneEndpointScript = `#!/bin/sh
S="$ORCHCOV_GH_STATE"
cat "$S/body"
exit "$(cat "$S/exit")"
`

Variables

This section is empty.

Functions

func InstallDirectCIGH

func InstallDirectCIGH(t Environment)

func InstallTransientReadGH

func InstallTransientReadGH(t Environment, script string)

InstallTransientReadGH puts a fake gh on PATH and pins the observer state dir so retries stay hermetic per test, without the reread-specific observation counter installRereadTestGH also wires up.

func PullRequestView

func PullRequestView[T any](t Reporter, head string) T

func WithEmptyActionsRuns

func WithEmptyActionsRuns(contents string) string

Types

type Environment

type Environment interface {
	Reporter
	TempDir() string
	Setenv(string, string)
}

Environment supplies a fixture's private paths and process environment.

type Reporter

type Reporter interface {
	Helper()
	Fatal(...any)
}

Reporter is the fatal error contract used by a concrete fixture. *testing.T implements it directly; an error observer can verify failing fixture inputs. Fatal must stop the current call, as testing.T.Fatal does.

type State

type State struct {
	Dir string
}

State is a scripted `gh` whose answers live in files, so a test can change one fact without rebuilding the whole script. It is deliberately independent of the other fixtures in this package: those install exactly the endpoints one verb needs, and the vendored reads below are shared by several.

func InstallGH

func InstallGH(t Environment, script string) State

InstallGH writes a `gh` shell script onto PATH and returns the state directory its answers are read from.

func ScriptState

func ScriptState(t Environment, script string) State

ScriptState writes a gh script whose answers are read from files and returns the state directory.

func (State) Answer

func (state State) Answer(t Reporter, name, contents string)

Answer records the body `gh` will print for one endpoint slot.

Jump to

Keyboard shortcuts

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