fakeplugin

package
v1.234.0-rc.1 Latest Latest
Warning

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

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

Documentation

Overview

Package fakeplugin lets a Go test binary act as a native Atmos plugin without shell commands or platform-specific executables. Call MaybeServe first in TestMain, then launch the test binary (os.Executable) as the plugin with its working directory set to a directory that WriteMode prepared.

Index

Constants

View Source
const (
	// ModeEcho writes "ok" and exits successfully.
	ModeEcho = "echo"
	// ModeHang records its pid and never returns, ignoring cancellation.
	ModeHang = "hang"
	// ModeSpawn is ModeHang plus a descendant process whose pid is recorded as well.
	ModeSpawn = "spawn"
)

Modes select what the fake plugin's command does.

Variables

This section is empty.

Functions

func MaybeServe

func MaybeServe(register ...func(*grpc.Server)) bool

MaybeServe runs the process as a fake plugin (or a long-sleeping helper) when launched as one and reports whether it did. Optional registration functions add fixture services. A true result means TestMain must return without running tests.

func PIDs

func PIDs(directory string) ([]int, error)

PIDs reads the process ids the plugin recorded; the plugin is first and descendants follow.

func WriteMode

func WriteMode(directory, mode string) error

WriteMode selects the fake plugin's behavior for processes started in directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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