Documentation
¶
Overview ¶
Package test provides e2e tests for Cargoship
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanFiles ¶
CleanFiles removes paths, failing the test on error rather than relying on .gitignore alone.
func GetCLIName ¶
func GetCLIName() string
GetCLIName looks at the OS and CPU architecture to determine which Cargoship binary needs to be run.
func RepoRoot ¶
RepoRoot walks up from the working directory to the directory holding go.mod, so a suite can sit at any depth under test/e2e without hard-coding how far up the root is.
func SetupInMemoryRegistry ¶
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.
func WaitForNodesReady ¶
func WaitForNodesReady(ctx context.Context, cs *kubernetes.Clientset, expectedCount int, timeout time.Duration) error
WaitForNodesReady polls the cluster until expectedCount nodes report Ready, or timeout elapses.
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 ¶
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.
The staging directory is handed over as DISTRO_TMP_DIR rather than --tmpdir: only the commands that stage package content register that flag, so passing it to every command fails argument parsing on the ones that do not (version, vault, ...). The environment variable is read by viper for all of them, and is ignored where nothing stages.
func (*CargoE2ETest) KubeClient ¶
func (e2e *CargoE2ETest) KubeClient(t *testing.T) (*kubernetes.Clientset, error)
KubeClient builds a Kubernetes clientset from the kubeconfig at $KUBECONFIG.
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. |