env

package
v0.57.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvironmentForgejoDev is the ENVIRONMENT value that selects the
	// Forgejo drivers.
	EnvironmentForgejoDev = "forgejo-dev"
	// SCMForgejo is the BEHAVIOUR_SCM value of the Forgejo SCM driver.
	SCMForgejo = "forgejo"
	// CIForgejoActions is the BEHAVIOUR_CI value of the Forgejo Actions
	// CI driver.
	CIForgejoActions = "forgejoactions"
)

Driver selections and the environment that requires them.

Variables

This section is empty.

Functions

func Duration

func Duration(name string, fallback time.Duration) (time.Duration, error)

Duration reads a Go duration (for example "5s" or "1m30s") from the named environment variable. It returns fallback when the variable is unset or empty. A value that does not parse, or is not positive, is an error, so a typo fails the suite instead of silently keeping the default.

The waits it tunes are sized for github.com, where events and runs lag. Against a local forge that delivers events at once they can be shortened.

func MustDuration

func MustDuration(name string, fallback time.Duration) time.Duration

MustDuration is Duration for package-level settings read once at start-up. It panics on an invalid value, naming the variable.

Types

type RunnerConfig

type RunnerConfig struct {
	SCM         string
	CI          string
	InstallMode string
	// Environment is the mint/infra target the suite is talking to
	// (`dev`, `stage`, `github-emulator` for a GitHub emulator at
	// BEHAVIOUR_GITHUB_URL, or `forgejo-dev`), from ENVIRONMENT. Empty
	// defaults to `dev` so local `make behaviour-test` works without
	// setting it. CI sets this to match the GitHub Environment on the
	// behaviour job. `forgejo-dev` selects the Forgejo SCM, CI, and
	// install drivers.
	Environment string

	// Capabilities lists environment capabilities the runner declares,
	// from the comma-separated BEHAVIOUR_CAPABILITIES env var. Scenarios
	// tagged @requires:capability:<name> are skipped unless <name> is
	// declared — the gate for coverage of behavior that only exists past
	// a certain dependency version (e.g. an agents-repo release).
	Capabilities []string
}

RunnerConfig holds behaviour test runner configuration from environment.

func LoadRunnerConfig

func LoadRunnerConfig() RunnerConfig

LoadRunnerConfig reads the runner configuration from the environment. BEHAVIOUR_SCM and BEHAVIOUR_CI default to the Forgejo drivers when ENVIRONMENT=forgejo-dev and to the GitHub drivers otherwise; explicit values are kept as given, and Validate rejects a mix.

func (RunnerConfig) HasCapability added in v0.35.1

func (c RunnerConfig) HasCapability(name string) bool

HasCapability reports whether the runner declared the named capability.

func (RunnerConfig) Validate

func (c RunnerConfig) Validate() error

Jump to

Keyboard shortcuts

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