Help us shape the future of Go! Take the 2026 Go Developer Survey

stubtool

package
v0.15.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package stubtool is a test double for passthrough tools (kubectl, helm, …). A test binary whose argv[0] basename is a tool name runs Main instead of its tests (see TestMain in internal/passthrough and cmd/obol), so the same binary serves as both the code under test and the tool it launches.

Behaviour, driven by env:

STUB_EXIT=<n>     exit with status n (default 0)
STUB_SIGNAL=TERM  kill itself with SIGTERM after reporting
STUB_SLEEP=<dur>  sleep before exiting (signal tests)

It writes one JSON Report line to stdout. `<tool> __complete <args…>` instead answers with cobra-style completion lines (see Main).

Index

Constants

This section is empty.

Variables

View Source
var Names = []string{"kubectl", "helm", "helmfile", "k9s", "stubtool"}

Names are the argv[0] basenames that select stub mode.

Functions

func IsStub

func IsStub() bool

IsStub reports whether this process was started as a stub tool.

func Main

func Main()

Main runs the stub and exits.

Types

type Report

type Report struct {
	Tool             string   `json:"tool"`
	Argv             []string `json:"argv"`
	Kubeconfig       *string  `json:"kubeconfig"`
	HelmfileFilePath *string  `json:"helmfile_file_path"`
	Stdin            string   `json:"stdin"`
	PID              int      `json:"pid"`
}

Report is what the stub prints.

Jump to

Keyboard shortcuts

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