Documentation
¶
Overview ¶
Package k8sctx is used to manage the lifecycle of a Kubernetes test or benchmark running in one or more Kubernetes clusters. It is used to control the behavior of Kubernetes-based tests and benchmarks at runtime and to abstract away how the Kubernetes test clusters are created and managed from the test code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEachCluster ¶
func ForEachCluster(ctx context.Context, t *testing.T, k8sCtx KubernetesContext, fn func(cluster *testcluster.TestCluster))
ForEachCluster calls the given function for each available cluster sequentially. In order to run per-cluster subtests in parallel, call `t.Run` inside `fn` and then `t.Parallel` inside that.
Types ¶
type KubernetesContext ¶
type KubernetesContext interface { // Cluster returns a single cluster for the test or benchmark to use. // The cluster is guaranteed to not be in use by other tests or benchmarks // until the returned function is called. // If there are no available clusters, it returns a nil TestCluster. Cluster(ctx context.Context, t *testing.T) (*testcluster.TestCluster, func()) // ResolveImage resolves a container image name (possibly with a label) // to a fully-qualified image name. It can also return an `image:label` // string if the Kubernetes cluster the test runs in will resolve it on // its own. ResolveImage(ctx context.Context, imageName string) (string, error) }
KubernetesContext represents the Kubernetes execution context. It is used to keep track of available Kubernetes clusters to test on. Tests are expected to call `RegisterTest` for every of their test function, then `TestMain`.
func New ¶
func New(testClusters ...*testcluster.TestCluster) KubernetesContext
New creates a KubernetesContext that set of test clusters.
Directories
¶
Path | Synopsis |
---|---|
Package kubectlctx provides a KubernetesContext that uses one or more kubectl configs to determine the cluster(s) to use for tests and benchmarks.
|
Package kubectlctx provides a KubernetesContext that uses one or more kubectl configs to determine the cluster(s) to use for tests and benchmarks. |