testutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinPath = "../../bin/vers"

	DefaultTimeout = 60 * time.Second
)

Variables

This section is empty.

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 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