clustertest

package
v0.0.0-...-2dfab7d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

package clustertest uses `kind` (https://kind.sigs.k8s.io/) to create an in-docker testing cluster. Because creating a new cluster can be a little bit slow, we lazily create a new cluster that is re-used across all users of the library (assuming they are in the same machine).

Since the cluster is shared, make sure your test scope their work on the cluster to their particular namespace

If a special environment variable is set it uses that cluster instead of creating one. Useful in environments when you want to run tests against an existing cluster instead of using `kind`.

Note that this library is meant as a light mechanism to do kubernetes tests in our unit tests. If we ever need an end-to-end solution, we should look at kubetest2 (https://github.com/kubernetes-sigs/kubetest2)

Index

Constants

View Source
const CLUSTERTEST_KUBECONFIG_PATH = "CLUSTERTEST_KUBECONFIG_PATH"

Environment variable used to specify a pre-existing cluster.

Variables

This section is empty.

Functions

func ClientBuilder

func ClientBuilder() kubeconfig.ClientBuilder

Convenience function that gets a client builder for the test cluster, or panics.

This is useful in unittest where this call is expected to succeed or the test should fail anyways.

func DefaultImage

func DefaultImage() string

Tests that don't need a special image, should just use this default image to avoid any issues like rate throttling.

func MustInitTestCluster

func MustInitTestCluster()

func Namespace

func Namespace(
	ctx context.Context,
	klient *reaktor.Reaktor,
) (*komponents.Namespace, func() error, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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