testbin

package
v0.17.10 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package testbin builds the swarm and swarm-fake-agent binaries once per test binary run, shared by the skeleton, protocol, and e2e integration suites that each need a real subprocess to shim/agent against.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillProcessesOf added in v0.17.8

func KillProcessesOf(exes ...string)

KillProcessesOf SIGKILLs every process other than this one whose executable is one of exes. A test run calls it last with the binaries it built (and its own test binary, which agents re-exec): shims deliberately outlive their daemon, so nothing else ends a session a test forgot to kill. Exe paths are unique per run, so no other run's processes match. Linux only: without /proc it does nothing.

Types

type Binaries

type Binaries struct {
	Swarm     string
	FakeAgent string
	// contains filtered or unexported fields
}

Binaries resolves the swarm and swarm-fake-agent binary paths, building them exactly once (guarded by an internal sync.Once) no matter how many times Build is called.

func (*Binaries) Build

func (b *Binaries) Build(t *testing.T, tmpPrefix string, onFail func(t *testing.T, err error))

Build compiles cmd/swarm and cmd/swarm-fake-agent into a fresh temp dir named tmpPrefix*, once. On a build failure every call (not just the first) invokes onFail with the recorded error, so each caller keeps its own skip-vs-fail policy instead of Build choosing one for everybody.

func (*Binaries) Sweep added in v0.17.8

func (b *Binaries) Sweep()

Sweep ends a run that used b: it kills every process still running b's binaries and removes the directory Build created. Call it from TestMain after m.Run.

Jump to

Keyboard shortcuts

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