Documentation
¶
Overview ¶
Package test contains helper functions for tests related to helm.
Index ¶
- Constants
- Variables
- func CheckConfigMap(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, ...)
- func CopyDir(source string, destination string) error
- func CreateNamespaceWithCleanup(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client) *corev1.Namespace
- func PackageChart(t *testing.T, chartDir string, destDir string) (string, int64)
- func StartHttpRegistryWithAuthAndCleanup(t *testing.T, glob string) string
- func StartHttpRegistryWithCleanup(t *testing.T, glob string) string
- func StartOciRegistry(t *testing.T, glob string) string
- func StartOciRegistryWithAuth(t *testing.T, glob string) (string, string)
- func StartTestEnvWithCleanup(t *testing.T, crdPath string) (context.Context, ctrlruntimeclient.Client, string)
Constants ¶
const ( // ConfigmapName is the Name of the config map deployed by the examplechart and examplechart-v2. ConfigmapName = "testcm" // ConfigmapName2 is the Name of the config map deployed by the examplechart and examplechart2. ConfigmapName2 = "testcm-2" // CmDataKey is the key in the values.yaml of examplechart / examplechart-v2 that holds custom configmap data. CmDataKey = "cmData" // VersionLabelKey is the key in the values.yaml of examplechart / examplechart-v2 that holds custom version label value. it's also the name of the label in the configmap. VersionLabelKey = "versionLabel" // DefaultVerionLabel is the default value of the version label the configmap deployed by pkg/applications/helmclient/testdata/examplechart chart. DefaultVerionLabel = "1.0" // DefaultVerionLabelV2 is the default value of the version label the configmap deployed by pkg/applications/helmclient/testdata/examplechart-v2 chart. DefaultVerionLabelV2 = "2.0" // EnableDNSLabelKey is the label key on cmData examplechart that allow test the enableDns deployOption. EnableDNSLabelKey = "enableDNSLabel" // SvcName is the name of the service deployed by chart chart-with-lb. SvcName = "svc-1" // DeploySvcKey is the key values.yaml of examplechart-v2 to enable / disabled the deployment of the service. DeploySvcKey = "deployService" )
Const relative to pkg/applications/helmclient/testdata/examplechart chart.
Variables ¶
var ( // DefaultData contains the default data of the configmap deployed by pkg/applications/helmclient/testdata/examplechart chart. DefaultData = map[string]string{"foo": "bar"} // DefaultDataV2 contains the default data of the configmap deployed by pkg/applications/helmclient/testdata/examplechart-v2 chart. DefaultDataV2 = map[string]string{"foo-version-2": "bar-version-2"} )
Functions ¶
func CheckConfigMap ¶ added in v2.22.0
func CheckConfigMap(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, ns *corev1.Namespace, expectedData map[string]string, expectedVersionLabel string, enableDns bool)
CheckConfigMap asserts that configMap deployed by helm chart has been created/ updated with the desired data and labels.
func CreateNamespaceWithCleanup ¶ added in v2.22.0
func CreateNamespaceWithCleanup(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client) *corev1.Namespace
CreateNamespaceWithCleanup creates a namespace with a generated name test-<something> and registers a hook on T.Cleanup that removes it at the end of the test.
func PackageChart ¶ added in v2.22.0
PackageChart packages the chart in chartDir into a chart archive file (i.e. a tgz) in destDir directory and returns the full path and the size of the archive.
func StartHttpRegistryWithAuthAndCleanup ¶ added in v2.22.0
StartHttpRegistryWithAuthAndCleanup starts a Helm http registry with basic auth enabled and uploads charts archives matching glob and returns the registry URL. the basic auth is hardcoded to Username: "username", Password: "password".
func StartHttpRegistryWithCleanup ¶ added in v2.22.0
StartHttpRegistryWithCleanup starts a Helm http registry and uploads charts archives matching glob and returns the registry URL.
func StartOciRegistry ¶ added in v2.22.0
StartOciRegistry start an oci registry and uploads charts archives matching glob and returns the registry URL.
func StartOciRegistryWithAuth ¶ added in v2.22.0
StartOciRegistryWithAuth start an oci registry with authentication, uploads charts archives matching glob, returns the registry URL and registryConfigFile. registryConfigFile contains the credentials of the registry.
func StartTestEnvWithCleanup ¶ added in v2.22.0
func StartTestEnvWithCleanup(t *testing.T, crdPath string) (context.Context, ctrlruntimeclient.Client, string)
StartTestEnvWithCleanup bootstraps the testing environment and return the to the kubeconfig. It also registers a hook on T.Cleanup to stop the env and remove the kubeconfig.
Types ¶
This section is empty.