test

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package test provides e2e tests for Cargoship

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCLIName

func GetCLIName() string

GetCLIName looks at the OS and CPU architecture to determine which Cargoship binary needs to be run.

func RepoRoot

func RepoRoot() (string, error)

RepoRoot walks up from the working directory to the directory holding go.mod, so a suite can sit at any depth under src/test/e2e without hard-coding how far up the root is.

func SetupInMemoryRegistry

func SetupInMemoryRegistry(t *testing.T) string

SetupInMemoryRegistry starts a plain-HTTP, in-memory OCI registry on an auto-allocated localhost port and returns its address (host:port). Use it against the built cargoship binary with the "--plain-http" flag, e.g. as the destination for "cargoship publish"/"pull" in e2e tests, without needing a real registry or network access. The registry is torn down automatically via t.Cleanup.

Types

type CargoE2ETest

type CargoE2ETest struct {
	CargoBinPath      string
	Arch              string
	ApplianceMode     bool
	ApplianceModeKeep bool
	// ClusterConfigPath is the absolute path to the generated ZarfCluster inventory YAML
	// pointing at the bootloose-provisioned test cluster. Empty if no cluster was set up.
	ClusterConfigPath string
}

CargoE2ETest Struct holding common fields most of the tests will utilize.

func Bootstrap

func Bootstrap() (CargoE2ETest, string, error)

Bootstrap chdirs into the repo root and returns a CargoE2ETest pointed at the binary built for this platform, along with the root it moved into. Suites that drive the CLI call this from TestMain: they spell every path (example distros, config files, testdata) relative to the repo root, and the binary under test is looked up under build/.

func BootstrapInProcess added in v0.20.0

func BootstrapInProcess() (CargoE2ETest, string, error)

BootstrapInProcess does what Bootstrap does without requiring a built binary, for suites that call the packages directly instead of shelling out to the CLI. Those suites still need the chdir and the architecture, but nothing under build/, so they can run from a bare checkout. The returned CargoE2ETest has no CargoBinPath and its Cargoship helpers will not work.

func (*CargoE2ETest) CargoInDir

func (e2e *CargoE2ETest) CargoInDir(t *testing.T, dir string, args ...string) (_ string, _ string, err error)

CargoInDir executes a Cargoship command in specific directory.

func (*CargoE2ETest) Cargoship

func (e2e *CargoE2ETest) Cargoship(t *testing.T, args ...string) (_ string, _ string, err error)

Cargoship executes a Cargoship command.

Directories

Path Synopsis
e2e
cluster
Package cluster holds the e2e tests that need a real multi-node cluster: the install command group, driven against containers provisioned by bootloose.
Package cluster holds the e2e tests that need a real multi-node cluster: the install command group, driven against containers provisioned by bootloose.

Jump to

Keyboard shortcuts

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