fakeplugin

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 12 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

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