Documentation ¶
Overview ¶
Package helm provides common functionalities for testing helm charts, such as calling out to the helm client.
Index ¶
- func Delete(t *testing.T, options *Options, releaseName string, purge bool)
- func DeleteE(t *testing.T, options *Options, releaseName string, purge bool) error
- func Install(t *testing.T, options *Options, chart string, releaseName string)
- func InstallE(t *testing.T, options *Options, chart string, releaseName string) error
- func RenderTemplate(t *testing.T, options *Options, chartDir string, templateFiles []string) string
- func RenderTemplateE(t *testing.T, options *Options, chartDir string, templateFiles []string) (string, error)
- func Rollback(t *testing.T, options *Options, releaseName string, revision string)
- func RollbackE(t *testing.T, options *Options, releaseName string, revision string) error
- func RunHelmCommandAndGetOutputE(t *testing.T, options *Options, cmd string, additionalArgs ...string) (string, error)
- func UnmarshalK8SYaml(t *testing.T, yamlData string, destinationObj interface{})
- func UnmarshalK8SYamlE(t *testing.T, yamlData string, destinationObj interface{}) error
- func Upgrade(t *testing.T, options *Options, chart string, releaseName string)
- func UpgradeE(t *testing.T, options *Options, chart string, releaseName string) error
- type ChartNotFoundError
- type Options
- type SetFileNotFoundError
- type TemplateFileNotFoundError
- type ValuesFileNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶ 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.
func DeleteE ¶ added in v0.13.28
DeleteE 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.
func Install ¶ added in v0.13.28
Install 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.
func InstallE ¶ added in v0.13.28
InstallE will install the selected helm chart with the provided options under the given release name.
func RenderTemplate ¶
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.
func RenderTemplateE ¶
func RenderTemplateE(t *testing.T, options *Options, chartDir string, templateFiles []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.
func Rollback ¶ added in v0.17.6
Rollback will downgrade the release to the specified version. This will fail the test if there is an error.
func RunHelmCommandAndGetOutputE ¶
func RunHelmCommandAndGetOutputE(t *testing.T, options *Options, cmd string, additionalArgs ...string) (string, error)
RunHelmCommandAndGetOutputE runs helm with the given arguments and options and returns stdout/stderr.
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.
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
type Options ¶
type Options struct { ValuesFiles []string // List of values files to render. SetValues map[string]string // Values that should be set via the command line. SetStrValues map[string]string // Values that should be set via the command line explicitly as `string` types. SetFiles map[string]string // Values that should be set from a file. These should be file paths. Use to avoid logging secrets. KubectlOptions *k8s.KubectlOptions // KubectlOptions to control how to authenticate to kubernetes cluster. `nil` => use defaults. HomePath string // The path to the helm home to use when calling out to helm. Empty string means use default ($HOME/.helm). EnvVars map[string]string // Environment variables to set when running helm }
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
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
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