Documentation
¶
Overview ¶
Package helm provides common functionalities for testing helm charts, such as calling out to the helm client.
Index ¶
- Variables
- func AddRepo(t testing.TestingT, options *Options, repoName string, repoURL string)deprecated
- func AddRepoContext(t testing.TestingT, ctx context.Context, options *Options, repoName string, ...)
- func AddRepoContextE(t testing.TestingT, ctx context.Context, options *Options, repoName string, ...) error
- func AddRepoE(t testing.TestingT, options *Options, repoName string, repoURL string) errordeprecated
- func Delete(t testing.TestingT, options *Options, releaseName string, purge bool)deprecated
- func DeleteContext(t testing.TestingT, ctx context.Context, options *Options, releaseName string, ...)
- func DeleteContextE(t testing.TestingT, ctx context.Context, options *Options, releaseName string, ...) error
- func DeleteE(t testing.TestingT, options *Options, releaseName string, purge bool) errordeprecated
- func DiffAgainstSnapshot(t testing.TestingT, options *Options, yamlData string, releaseName string) intdeprecated
- func DiffAgainstSnapshotContext(t testing.TestingT, ctx context.Context, options *Options, yamlData string, ...) int
- func DiffAgainstSnapshotContextE(t testing.TestingT, ctx context.Context, options *Options, yamlData string, ...) (int, error)
- func DiffAgainstSnapshotE(t testing.TestingT, options *Options, yamlData string, releaseName string) (int, error)deprecated
- func FormatSetFilesAsArgs(t testing.TestingT, setFiles map[string]string) []stringdeprecated
- func FormatSetFilesAsArgsContext(t testing.TestingT, ctx context.Context, setFiles map[string]string) []string
- func FormatSetFilesAsArgsContextE(ctx context.Context, setFiles map[string]string) ([]string, error)
- func FormatSetFilesAsArgsE(setFiles map[string]string) ([]string, error)deprecated
- func FormatSetValuesAsArgs(setValues map[string]string, flag string) []string
- func FormatValuesFilesAsArgs(t testing.TestingT, valuesFiles []string) []stringdeprecated
- func FormatValuesFilesAsArgsContext(t testing.TestingT, ctx context.Context, valuesFiles []string) []string
- func FormatValuesFilesAsArgsContextE(ctx context.Context, valuesFiles []string) ([]string, error)
- func FormatValuesFilesAsArgsE(valuesFiles []string) ([]string, error)deprecated
- func Install(t testing.TestingT, options *Options, chart string, releaseName string)deprecated
- func InstallContext(t testing.TestingT, ctx context.Context, options *Options, chart string, ...)
- func InstallContextE(t testing.TestingT, ctx context.Context, options *Options, chart string, ...) error
- func InstallE(t testing.TestingT, options *Options, chart string, releaseName string) errordeprecated
- func PrepareHelmCommand(options *Options, cmd string, additionalArgs ...string) *shell.Command
- func RemoveRepo(t testing.TestingT, options *Options, repoName string)deprecated
- func RemoveRepoContext(t testing.TestingT, ctx context.Context, options *Options, repoName string)
- func RemoveRepoContextE(t testing.TestingT, ctx context.Context, options *Options, repoName string) error
- func RemoveRepoE(t testing.TestingT, options *Options, repoName string) errordeprecated
- func RenderRemoteTemplate(t testing.TestingT, options *Options, chartURL string, releaseName string, ...) stringdeprecated
- func RenderRemoteTemplateContext(t testing.TestingT, ctx context.Context, options *Options, chartURL string, ...) string
- func RenderRemoteTemplateContextE(t testing.TestingT, ctx context.Context, options *Options, chartURL string, ...) (string, error)
- func RenderRemoteTemplateE(t testing.TestingT, options *Options, chartURL string, releaseName string, ...) (string, error)deprecated
- func RenderTemplate(t testing.TestingT, options *Options, chartDir string, releaseName string, ...) stringdeprecated
- func RenderTemplateAndGetStdOutErrContextE(t testing.TestingT, ctx context.Context, options *Options, chartDir string, ...) (string, string, error)
- func RenderTemplateAndGetStdOutErrE(t testing.TestingT, options *Options, chartDir string, releaseName string, ...) (string, string, error)deprecated
- func RenderTemplateContext(t testing.TestingT, ctx context.Context, options *Options, chartDir string, ...) string
- func RenderTemplateContextE(t testing.TestingT, ctx context.Context, options *Options, chartDir string, ...) (string, error)
- func RenderTemplateE(t testing.TestingT, options *Options, chartDir string, releaseName string, ...) (string, error)deprecated
- func Rollback(t testing.TestingT, options *Options, releaseName string, revision string)deprecated
- func RollbackContext(t testing.TestingT, ctx context.Context, options *Options, releaseName string, ...)
- func RollbackContextE(t testing.TestingT, ctx context.Context, options *Options, releaseName string, ...) error
- func RollbackE(t testing.TestingT, options *Options, releaseName string, revision string) errordeprecated
- func RunHelmCommandAndGetOutputContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, ...) (string, error)
- func RunHelmCommandAndGetOutputE(t testing.TestingT, options *Options, cmd string, additionalArgs ...string) (string, error)deprecated
- func RunHelmCommandAndGetStdOutContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, ...) (string, error)
- func RunHelmCommandAndGetStdOutE(t testing.TestingT, options *Options, cmd string, additionalArgs ...string) (string, error)deprecated
- func RunHelmCommandAndGetStdOutErrContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, ...) (string, string, error)
- func RunHelmCommandAndGetStdOutErrE(t testing.TestingT, options *Options, cmd string, additionalArgs ...string) (string, string, error)deprecated
- func UnmarshalK8SYaml(t testing.TestingT, yamlData string, destinationObj any)
- func UnmarshalK8SYamlE(t testing.TestingT, yamlData string, destinationObj any) error
- func UnmarshalK8SYamls[T any](t testing.TestingT, yamlData string, destinationObj *[]T, check func(v T) bool)
- func UnmarshalK8SYamlsE[T any](t testing.TestingT, yamlData string, destinationObj *[]T, check func(v T) bool) error
- func UpdateSnapshot(t testing.TestingT, options *Options, yamlData string, releaseName string)deprecated
- func UpdateSnapshotContext(t testing.TestingT, ctx context.Context, options *Options, yamlData string, ...)
- func UpdateSnapshotContextE(t testing.TestingT, ctx context.Context, options *Options, yamlData string, ...) error
- func UpdateSnapshotE(t testing.TestingT, options *Options, yamlData string, releaseName string) errordeprecated
- func Upgrade(t testing.TestingT, options *Options, chart string, releaseName string)deprecated
- func UpgradeContext(t testing.TestingT, ctx context.Context, options *Options, chart string, ...)
- func UpgradeContextE(t testing.TestingT, ctx context.Context, options *Options, chart string, ...) error
- func UpgradeE(t testing.TestingT, options *Options, chart string, releaseName string) errordeprecated
- type ChartNotFoundError
- type Options
- type SetFileNotFoundError
- type TemplateFileNotFoundError
- type ValuesFileNotFoundError
Constants ¶
This section is empty.
Variables ¶
var ErrDestinationNotPointer = errors.New("destinationObj must be a pointer")
ErrDestinationNotPointer is returned when the destination object passed to an unmarshal function is not a pointer.
var ErrNoMatchingData = errors.New("no matching raw data were found for the concrete type")
ErrNoMatchingData is returned when no matching raw data are found for the concrete type during YAML unmarshalling.
var ErrYAMLRootIsArray = errors.New("YAML root is an array, but destinationObj is a single object")
ErrYAMLRootIsArray is returned when the YAML root is an array but the destination object is a single object.
Functions ¶
func AddRepoContext ¶ added in v1.0.0
func AddRepoContext(t testing.TestingT, ctx context.Context, options *Options, repoName string, repoURL string)
AddRepoContext will setup the provided helm repository to the local helm client configuration. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func AddRepoContextE ¶ added in v1.0.0
func AddRepoContextE(t testing.TestingT, ctx context.Context, options *Options, repoName string, repoURL string) error
AddRepoContextE will setup the provided helm repository to the local helm client configuration. The ctx parameter supports cancellation and timeouts.
func Delete
deprecated
added in
v0.13.28
Delete will delete the provided release from Tiller. If you set purge to true, Tiller will delete the release object as well so that the release name can be reused. This will fail the test if there is an error.
Deprecated: Use DeleteContext instead.
func DeleteContext ¶ added in v1.0.0
func DeleteContext(t testing.TestingT, ctx context.Context, options *Options, releaseName string, purge bool)
DeleteContext will delete the provided release. If you set purge to true, the release object will be deleted as well so that the release name can be reused. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func DeleteContextE ¶ added in v1.0.0
func DeleteContextE(t testing.TestingT, ctx context.Context, options *Options, releaseName string, purge bool) error
DeleteContextE will delete the provided release. If you set purge to true, the release object will be deleted as well so that the release name can be reused. The ctx parameter supports cancellation and timeouts.
func DeleteE
deprecated
added in
v0.13.28
func DiffAgainstSnapshot
deprecated
added in
v0.46.9
func DiffAgainstSnapshot(t testing.TestingT, options *Options, yamlData string, releaseName string) int
DiffAgainstSnapshot compares the current manifests of a chart (e.g bitnami/nginx) with the previous manifests stored in the snapshot. see https://github.com/gruntwork-io/terratest/issues/1377 It returns the number of differences between the two manifests or -1 in case of error. It will fail the test if there is an error while reading or writing the two manifests in the file system.
Deprecated: Use DiffAgainstSnapshotContext instead.
func DiffAgainstSnapshotContext ¶ added in v1.0.0
func DiffAgainstSnapshotContext(t testing.TestingT, ctx context.Context, options *Options, yamlData string, releaseName string) int
DiffAgainstSnapshotContext compares the current manifests of a chart (e.g bitnami/nginx) with the previous manifests stored in the snapshot. see https://github.com/gruntwork-io/terratest/issues/1377 It returns the number of differences between the two manifests or -1 in case of error. The ctx parameter is accepted for API consistency with other Context-aware helpers. It will fail the test if there is an error while reading or writing the two manifests in the file system.
func DiffAgainstSnapshotContextE ¶ added in v1.0.0
func DiffAgainstSnapshotContextE(t testing.TestingT, ctx context.Context, options *Options, yamlData string, releaseName string) (int, error)
DiffAgainstSnapshotContextE compares the current manifests of a chart (e.g bitnami/nginx) with the previous manifests stored in the snapshot. see https://github.com/gruntwork-io/terratest/issues/1377 The ctx parameter is accepted for API consistency with other Context-aware helpers. It returns the number of differences between the manifests or -1 in case of error.
func DiffAgainstSnapshotE
deprecated
added in
v0.46.9
func DiffAgainstSnapshotE(t testing.TestingT, options *Options, yamlData string, releaseName string) (int, error)
DiffAgainstSnapshotE compares the current manifests of a chart (e.g bitnami/nginx) with the previous manifests stored in the snapshot. see https://github.com/gruntwork-io/terratest/issues/1377 It returns the number of differences between the manifests or -1 in case of error.
Deprecated: Use DiffAgainstSnapshotContextE instead.
func FormatSetFilesAsArgs
deprecated
added in
v1.0.0
FormatSetFilesAsArgs formats the given list of keys and file paths as command line args for helm to set from file (e.g of the format --set-file key=path). This will fail the test if one of the paths do not exist or the absolute path can not be determined.
Deprecated: Use FormatSetFilesAsArgsContext instead.
func FormatSetFilesAsArgsContext ¶ added in v1.0.0
func FormatSetFilesAsArgsContext(t testing.TestingT, ctx context.Context, setFiles map[string]string) []string
FormatSetFilesAsArgsContext formats the given list of keys and file paths as command line args for helm to set from file (e.g of the format --set-file key=path). The ctx parameter is accepted for API consistency with other Context-aware helpers. This will fail the test if one of the paths do not exist or the absolute path can not be determined.
func FormatSetFilesAsArgsContextE ¶ added in v1.0.0
func FormatSetFilesAsArgsContextE(ctx context.Context, setFiles map[string]string) ([]string, error)
FormatSetFilesAsArgsContextE formats the given list of keys and file paths as command line args for helm to set from file (e.g of the format --set-file key=path). The ctx parameter is accepted for API consistency with other Context-aware helpers.
func FormatSetFilesAsArgsE
deprecated
added in
v1.0.0
FormatSetFilesAsArgsE formats the given list of keys and file paths as command line args for helm to set from file (e.g of the format --set-file key=path).
Deprecated: Use FormatSetFilesAsArgsContextE instead.
func FormatSetValuesAsArgs ¶ added in v1.0.0
FormatSetValuesAsArgs formats the given values as command line args for helm using the given flag (e.g flags of the format "--set"/"--set-string"/"--set-json" resulting in args like --set/set-string/set-json key=value...).
func FormatValuesFilesAsArgs
deprecated
added in
v1.0.0
FormatValuesFilesAsArgs formats the given list of values file paths as command line args for helm (e.g of the format -f path). This will fail the test if one of the paths do not exist or the absolute path can not be determined.
Deprecated: Use FormatValuesFilesAsArgsContext instead.
func FormatValuesFilesAsArgsContext ¶ added in v1.0.0
func FormatValuesFilesAsArgsContext(t testing.TestingT, ctx context.Context, valuesFiles []string) []string
FormatValuesFilesAsArgsContext formats the given list of values file paths as command line args for helm (e.g of the format -f path). The ctx parameter is accepted for API consistency with other Context-aware helpers. This will fail the test if one of the paths do not exist or the absolute path can not be determined.
func FormatValuesFilesAsArgsContextE ¶ added in v1.0.0
FormatValuesFilesAsArgsContextE formats the given list of values file paths as command line args for helm (e.g of the format -f path). The ctx parameter is accepted for API consistency with other Context-aware helpers. This will error if the file does not exist.
func FormatValuesFilesAsArgsE
deprecated
added in
v1.0.0
FormatValuesFilesAsArgsE formats the given list of values file paths as command line args for helm (e.g of the format -f path). This will error if the file does not exist.
Deprecated: Use FormatValuesFilesAsArgsContextE instead.
func Install
deprecated
added in
v0.13.28
func InstallContext ¶ added in v1.0.0
func InstallContext(t testing.TestingT, ctx context.Context, options *Options, chart string, releaseName string)
InstallContext will install the selected helm chart with the provided options under the given release name. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func InstallContextE ¶ added in v1.0.0
func InstallContextE(t testing.TestingT, ctx context.Context, options *Options, chart string, releaseName string) error
InstallContextE will install the selected helm chart with the provided options under the given release name. The ctx parameter supports cancellation and timeouts.
func PrepareHelmCommand ¶ added in v1.0.0
PrepareHelmCommand builds a shell.Command for running helm with the given options, subcommand, and additional arguments.
func RemoveRepo
deprecated
added in
v0.30.24
RemoveRepo will remove the provided helm repository from the local helm client configuration. This will fail the test if there is an error.
Deprecated: Use RemoveRepoContext instead.
func RemoveRepoContext ¶ added in v1.0.0
RemoveRepoContext will remove the provided helm repository from the local helm client configuration. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func RemoveRepoContextE ¶ added in v1.0.0
func RemoveRepoContextE(t testing.TestingT, ctx context.Context, options *Options, repoName string) error
RemoveRepoContextE will remove the provided helm repository from the local helm client configuration. The ctx parameter supports cancellation and timeouts.
func RemoveRepoE
deprecated
added in
v0.30.24
func RenderRemoteTemplate
deprecated
added in
v0.46.6
func RenderRemoteTemplate(t testing.TestingT, options *Options, chartURL string, releaseName string, templateFiles []string, extraHelmArgs ...string) string
RenderRemoteTemplate runs `helm template` to render a remote chart given the provided options and returns stdout from the template command. If you pass in templateFiles, this will only render those templates. This function will fail the test if there is an error rendering the template.
Deprecated: Use RenderRemoteTemplateContext instead.
func RenderRemoteTemplateContext ¶ added in v1.0.0
func RenderRemoteTemplateContext(t testing.TestingT, ctx context.Context, options *Options, chartURL string, releaseName string, templateFiles []string, extraHelmArgs ...string) string
RenderRemoteTemplateContext runs `helm template` to render a remote chart given the provided options and returns stdout from the template command. If you pass in templateFiles, this will only render those templates. This function will fail the test if there is an error rendering the template. The ctx parameter supports cancellation and timeouts.
func RenderRemoteTemplateContextE ¶ added in v1.0.0
func RenderRemoteTemplateContextE(t testing.TestingT, ctx context.Context, options *Options, chartURL string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, error)
RenderRemoteTemplateContextE runs `helm template` to render a remote helm chart given the provided options and returns stdout from the template command. If you pass in templateFiles, this will only render those templates. The ctx parameter supports cancellation and timeouts.
func RenderRemoteTemplateE
deprecated
added in
v0.46.6
func RenderRemoteTemplateE(t testing.TestingT, options *Options, chartURL string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, error)
RenderRemoteTemplateE runs `helm template` to render a remote helm chart given the provided options and returns stdout/stderr from the template command. If you pass in templateFiles, this will only render those templates.
Deprecated: Use RenderRemoteTemplateContextE instead.
func RenderTemplate
deprecated
func RenderTemplate(t testing.TestingT, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) string
RenderTemplate runs `helm template` to render the template given the provided options and returns stdout/stderr from the template command. If you pass in templateFiles, this will only render those templates. This function will fail the test if there is an error rendering the template.
Deprecated: Use RenderTemplateContext instead.
func RenderTemplateAndGetStdOutErrContextE ¶ added in v1.0.0
func RenderTemplateAndGetStdOutErrContextE(t testing.TestingT, ctx context.Context, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, string, error)
RenderTemplateAndGetStdOutErrContextE runs `helm template` to render the template given the provided options and returns stdout and stderr separately from the template command. If you pass in templateFiles, this will only render those templates. The ctx parameter supports cancellation and timeouts.
func RenderTemplateAndGetStdOutErrE
deprecated
added in
v0.49.0
func RenderTemplateAndGetStdOutErrE(t testing.TestingT, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, string, error)
RenderTemplateAndGetStdOutErrE runs `helm template` to render the template given the provided options and returns stdout and stderr separately from the template command. If you pass in templateFiles, this will only render those templates.
Deprecated: Use RenderTemplateAndGetStdOutErrContextE instead.
func RenderTemplateContext ¶ added in v1.0.0
func RenderTemplateContext(t testing.TestingT, ctx context.Context, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) string
RenderTemplateContext runs `helm template` to render the template given the provided options and returns stdout from the template command. If you pass in templateFiles, this will only render those templates. This function will fail the test if there is an error rendering the template. The ctx parameter supports cancellation and timeouts.
func RenderTemplateContextE ¶ added in v1.0.0
func RenderTemplateContextE(t testing.TestingT, ctx context.Context, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, error)
RenderTemplateContextE runs `helm template` to render the template given the provided options and returns stdout from the template command. If you pass in templateFiles, this will only render those templates. The ctx parameter supports cancellation and timeouts.
func RenderTemplateE
deprecated
func RenderTemplateE(t testing.TestingT, options *Options, chartDir string, releaseName string, templateFiles []string, extraHelmArgs ...string) (string, error)
RenderTemplateE runs `helm template` to render the template given the provided options and returns stdout/stderr from the template command. If you pass in templateFiles, this will only render those templates.
Deprecated: Use RenderTemplateContextE instead.
func RollbackContext ¶ added in v1.0.0
func RollbackContext(t testing.TestingT, ctx context.Context, options *Options, releaseName string, revision string)
RollbackContext will downgrade the release to the specified version. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func RollbackContextE ¶ added in v1.0.0
func RollbackContextE(t testing.TestingT, ctx context.Context, options *Options, releaseName string, revision string) error
RollbackContextE will downgrade the release to the specified version. The ctx parameter supports cancellation and timeouts.
func RunHelmCommandAndGetOutputContextE ¶ added in v1.0.0
func RunHelmCommandAndGetOutputContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, additionalArgs ...string) (string, error)
RunHelmCommandAndGetOutputContextE runs helm with the given arguments and options and returns combined, interleaved stdout/stderr. The ctx parameter supports cancellation and timeouts.
func RunHelmCommandAndGetOutputE
deprecated
func RunHelmCommandAndGetOutputE(t testing.TestingT, options *Options, cmd string, additionalArgs ...string) (string, error)
RunHelmCommandAndGetOutputE runs helm with the given arguments and options and returns combined, interleaved stdout/stderr.
Deprecated: Use RunHelmCommandAndGetOutputContextE instead.
func RunHelmCommandAndGetStdOutContextE ¶ added in v1.0.0
func RunHelmCommandAndGetStdOutContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, additionalArgs ...string) (string, error)
RunHelmCommandAndGetStdOutContextE runs helm with the given arguments and options and returns stdout. The ctx parameter supports cancellation and timeouts.
func RunHelmCommandAndGetStdOutE
deprecated
added in
v0.32.18
func RunHelmCommandAndGetStdOutErrContextE ¶ added in v1.0.0
func RunHelmCommandAndGetStdOutErrContextE(t testing.TestingT, ctx context.Context, options *Options, cmd string, additionalArgs ...string) (string, string, error)
RunHelmCommandAndGetStdOutErrContextE runs helm with the given arguments and options and returns stdout and stderr separately. The ctx parameter supports cancellation and timeouts.
func RunHelmCommandAndGetStdOutErrE
deprecated
added in
v0.49.0
func RunHelmCommandAndGetStdOutErrE(t testing.TestingT, options *Options, cmd string, additionalArgs ...string) (string, string, error)
RunHelmCommandAndGetStdOutErrE runs helm with the given arguments and options and returns stdout and stderr separately.
Deprecated: Use RunHelmCommandAndGetStdOutErrContextE instead.
func UnmarshalK8SYaml ¶
UnmarshalK8SYaml is the same as UnmarshalK8SYamlE, but will fail the test if there is an error.
func UnmarshalK8SYamlE ¶
UnmarshalK8SYamlE can be used to take template outputs and unmarshal them into the corresponding client-go struct. For example, suppose you render the template into a Deployment object. You can unmarshal the yaml as follows:
var deployment appsv1.Deployment UnmarshalK8SYamlE(t, renderedOutput, &deployment)
At the end of this, the deployment variable will be populated.
func UnmarshalK8SYamls ¶ added in v0.49.0
func UnmarshalK8SYamls[T any](t testing.TestingT, yamlData string, destinationObj *[]T, check func(v T) bool)
UnmarshalK8SYamls is the same as UnmarshalK8SYamlsE, but will fail the test if there is an error.
func UnmarshalK8SYamlsE ¶ added in v0.49.0
func UnmarshalK8SYamlsE[T any](t testing.TestingT, yamlData string, destinationObj *[]T, check func(v T) bool) error
UnmarshalK8SYamlsE tries to unmarshal YAML that contains multiple Kubernetes objects into a slice of a concrete type. It requires the caller to pass a check function to determine whether each unmarshalled object is valid. It will ignore errors or invalid objects, but if no valid objects are found, it will return an error.
func UpdateSnapshot
deprecated
added in
v0.46.9
UpdateSnapshot creates or updates the k8s manifest snapshot of a chart (e.g bitnami/nginx). It is one of the two functions needed to implement snapshot based testing for helm. see https://github.com/gruntwork-io/terratest/issues/1377 A snapshot is used to compare the current manifests of a chart with the previous manifests. A global diff is run against the two snapshots and the number of differences is returned.
Deprecated: Use UpdateSnapshotContext instead.
func UpdateSnapshotContext ¶ added in v1.0.0
func UpdateSnapshotContext(t testing.TestingT, ctx context.Context, options *Options, yamlData string, releaseName string)
UpdateSnapshotContext creates or updates the k8s manifest snapshot of a chart (e.g bitnami/nginx). It is one of the two functions needed to implement snapshot based testing for helm. see https://github.com/gruntwork-io/terratest/issues/1377 A snapshot is used to compare the current manifests of a chart with the previous manifests. A global diff is run against the two snapshots and the number of differences is returned. The ctx parameter is accepted for API consistency with other Context-aware helpers.
func UpdateSnapshotContextE ¶ added in v1.0.0
func UpdateSnapshotContextE(t testing.TestingT, ctx context.Context, options *Options, yamlData string, releaseName string) error
UpdateSnapshotContextE creates or updates the k8s manifest snapshot of a chart (e.g bitnami/nginx). It is one of the two functions needed to implement snapshot based testing for helm. see https://github.com/gruntwork-io/terratest/issues/1377 A snapshot is used to compare the current manifests of a chart with the previous manifests. A global diff is run against the two snapshots and the number of differences is returned. The ctx parameter is accepted for API consistency with other Context-aware helpers. It will return an error if there is an issue while writing the manifests' snapshot in the file system.
func UpdateSnapshotE
deprecated
added in
v0.46.9
func UpdateSnapshotE(t testing.TestingT, options *Options, yamlData string, releaseName string) error
UpdateSnapshotE creates or updates the k8s manifest snapshot of a chart (e.g bitnami/nginx). It is one of the two functions needed to implement snapshot based testing for helm. see https://github.com/gruntwork-io/terratest/issues/1377 A snapshot is used to compare the current manifests of a chart with the previous manifests. A global diff is run against the two snapshots and the number of differences is returned. It will fail the test if there is an error while writing the manifests' snapshot in the file system.
Deprecated: Use UpdateSnapshotContextE instead.
func Upgrade
deprecated
added in
v0.17.6
func UpgradeContext ¶ added in v1.0.0
func UpgradeContext(t testing.TestingT, ctx context.Context, options *Options, chart string, releaseName string)
UpgradeContext will upgrade the release and chart will be deployed with the latest configuration. This will fail the test if there is an error. The ctx parameter supports cancellation and timeouts.
func UpgradeContextE ¶ added in v1.0.0
func UpgradeContextE(t testing.TestingT, ctx context.Context, options *Options, chart string, releaseName string) error
UpgradeContextE will upgrade the release and chart will be deployed with the latest configuration. The ctx parameter supports cancellation and timeouts.
Types ¶
type ChartNotFoundError ¶ added in v0.13.28
type ChartNotFoundError struct {
Path string
}
ChartNotFoundError is returned when a provided chart dir is not found.
func (ChartNotFoundError) Error ¶ added in v0.13.28
func (err ChartNotFoundError) Error() string
Error implements the error interface for ChartNotFoundError.
type Options ¶
type Options struct {
// Set a non-default logger that should be used. See the logger package for more info.
// Use logger.Discard to not print the output while executing the command.
Logger *logger.Logger
// Values that should be set via the command line.
SetValues map[string]string
// Values that should be set via the command line explicitly as `string` types.
SetStrValues map[string]string
// SetJSONValues are values that should be set via the command line in JSON format.
SetJSONValues map[string]string
// Deprecated: Use [SetJSONValues] instead.
SetJsonValues map[string]string //nolint:revive,staticcheck // Deprecated field kept for backwards compatibility.
// Values that should be set from a file. These should be file paths. Use to avoid logging secrets.
SetFiles map[string]string
// KubectlOptions to control how to authenticate to kubernetes cluster. `nil` => use defaults.
KubectlOptions *k8s.KubectlOptions
// Environment variables to set when running helm.
EnvVars map[string]string
// Extra arguments to pass to the helm install/upgrade/rollback/delete and helm repo add commands.
// The key signals the command (e.g., install) while the values are the extra arguments to pass through.
ExtraArgs map[string][]string
// The path to the helm home to use when calling out to helm.
// Empty string means use default ($HOME/.helm).
HomePath string
// Version of chart.
Version string
// The path to the snapshot directory when using snapshot based testing.
// Empty string means use default ($PWD/__snapshot__).
SnapshotPath string
// List of values files to render.
ValuesFiles []string
// If true, helm dependencies will be built before rendering template, installing or upgrading the chart.
BuildDependencies bool
}
Options represents the options for a Helm command.
type SetFileNotFoundError ¶
type SetFileNotFoundError struct {
Path string
}
SetFileNotFoundError is returned when a provided set file input is not found on the host path.
func (SetFileNotFoundError) Error ¶
func (err SetFileNotFoundError) Error() string
Error implements the error interface for SetFileNotFoundError.
type TemplateFileNotFoundError ¶
TemplateFileNotFoundError is returned when a provided template file input is not found in the chart.
func (TemplateFileNotFoundError) Error ¶
func (err TemplateFileNotFoundError) Error() string
Error implements the error interface for TemplateFileNotFoundError.
type ValuesFileNotFoundError ¶
type ValuesFileNotFoundError struct {
Path string
}
ValuesFileNotFoundError is returned when a provided values file input is not found on the host path.
func (ValuesFileNotFoundError) Error ¶
func (err ValuesFileNotFoundError) Error() string
Error implements the error interface for ValuesFileNotFoundError.