testenv

package
v0.175.0-rc.310 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 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.

README

Real binary supervisor workflow

Run on Linux with Go, Git and util-linux unshare installed:

go test ./internal/testenv -run TestSupervisorWorkflow -count=1 -v

The test builds the current candidate from the repository. Two parallel runs start it through separate supervisor --once passes, each with its own config, state store, board adapter and bare Git origin. The production start path launches deterministic background workers. They push a real branch, create a pull request through gh, park through Beekeeper, and publish reviews through GitHub's review endpoint. A stale approval must leave the base unchanged; the exact-head review must pass the real parser, planner, merge validation and gate. Assertions read the bare origin's commit and tree, independent durable registrations, durable review completion, and gate/supervisor completion events.

Only external GitHub and Claude interfaces are replaced. A Git remote helper connects Git's actual upload/receive-pack protocol to the bare origin while preserving the production-shaped remote URL. Unknown CLI/API/transport requests fail. Fixture API state is locked and atomically replaced across subprocesses. The initial watch budget observation is seeded in the scratch state store; automatic installation is paused there to keep release discovery out of this workflow.

Each run enters fresh user, mount, PID and network namespaces. Its filesystem contains read-only system executables/libraries, a private /proc, and its own writable scratch directories. Host homes, configuration, runtime sockets and credentials are absent. Child environments use an explicit allowlist. The test checks that an outbound connection fails and deliberately supplies fake inherited credentials to verify they do not reach the candidate. Kernel namespace teardown kills descendants even when the driver is interrupted; an interruption subtest checks this while the other workflows run. Cleanup only removes that run's testing.T.TempDir.

The test skips with a reason when user/mount/PID/network namespaces are unavailable or go test -short is requested. Existing command-level loopRig tests remain unchanged and cover the planner's smaller cases without this Linux prerequisite.

Documentation

Overview

Package testenv isolates test binaries from the desk that starts them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnterSandbox

func EnterSandbox(root string) error

EnterSandbox prepares a private mount namespace, then enters a filesystem containing only system executables and this run's workspace. The caller must already be in fresh user, mount, PID and network namespaces (unshare -Urmpnf). No host home, runtime sockets, credentials, or other test runs are mounted. Namespace teardown, including on interruption, never unmounts the host's mounts.

func Setup

func Setup()

Setup runs before m.Run, after any test-binary helper dispatch. Tests set their own identity with t.Setenv; child helpers keep that explicit identity. BEEKEEPER_TEST_* includes integration inputs and child-helper dispatch flags; clearing the latter would turn a helper into another test-suite run.

func WorkflowEnv

func WorkflowEnv() []string

WorkflowEnv is an allowlist, deliberately independent of os.Environ. GitHub Git transport uses the fixture remote helper; Git has no system or user config. The private network namespace also blocks direct socket calls.

Types

This section is empty.

Jump to

Keyboard shortcuts

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