testutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 60 * time.Second
)

Variables

View Source
var (
	BinPath string
)

Functions

func EnsureBuilt

func EnsureBuilt(t TLike)

EnsureBuilt builds the CLI binary if it doesn't exist.

func ParseVMID

func ParseVMID(output string) (string, error)

ParseVMID extracts the VM ID from `vers run` output. The output format is: "VM '<vmID>' started successfully."

func RegisterVMCleanup

func RegisterVMCleanup(t TLike, identifier string, recursive bool)

RegisterVMCleanup ensures a VM is deleted at test end.

func RunVers

func RunVers(t TLike, timeout time.Duration, args ...string) (string, error)

RunVers executes the CLI with a timeout and returns combined stdout/stderr and error.

func RunVersInDir added in v0.6.0

func RunVersInDir(t TLike, dir string, timeout time.Duration, args ...string) (string, error)

RunVersInDir executes the CLI in a specific working directory.

func TestEnv

func TestEnv(t TLike)

TestEnv ensures required env vars are present; loads root .env if found.

func UniqueAlias

func UniqueAlias(prefix string) string

UniqueAlias returns a unique alias string scoped to a test run.

Types

type TLike

type TLike interface {
	Cleanup(func())
	Fatalf(string, ...any)
	Skipf(string, ...any)
}

TLike is the subset of *testing.T methods we use; helps reuse in helpers.

Jump to

Keyboard shortcuts

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