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 ¶
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()
Types ¶
This section is empty.