mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-20 17:48:14 +02:00
feat: add helm-unittest integration
This commit adds support for running helm-unittest on releases defined in helmfile.
Features:
- Add unittest command to run helm-unittest on releases
- Add unitTests field to release spec for specifying test directories
- Add helm-unittest plugin to init command
- Support for --values, --fail-fast, --color, --debug-plugin, --unittest-args flags
- Concurrent execution support
- Integration with needs/selectors like other commands
Example usage:
helmfile unittest -e test
helmfile unittest --fail-fast --color
helmfile unittest --values values.yaml
Example helmfile.yaml:
releases:
- name: myapp
chart: ./charts/myapp
unitTests:
- tests/
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -649,6 +649,17 @@ func (helm *execer) TemplateRelease(name string, chart string, flags ...string)
|
||||
return err
|
||||
}
|
||||
|
||||
func (helm *execer) UnittestRelease(context HelmContext, name, chart string, flags ...string) error {
|
||||
helm.logger.Infof("Running unittest for release=%v, chart=%v", name, redactedURL(chart))
|
||||
preArgs := make([]string, 0)
|
||||
env := make(map[string]string)
|
||||
var overrideEnableLiveOutput *bool = nil
|
||||
|
||||
out, err := helm.exec(append(append(preArgs, "unittest", chart), flags...), env, overrideEnableLiveOutput)
|
||||
helm.write(context.Writer, out)
|
||||
return err
|
||||
}
|
||||
|
||||
func (helm *execer) DiffRelease(context HelmContext, name, chart, namespace string, suppressDiff bool, flags ...string) error {
|
||||
diffMsg := fmt.Sprintf("Comparing release=%v, chart=%v, namespace=%v\n", name, redactedURL(chart), namespace)
|
||||
if context.Writer != nil && !suppressDiff {
|
||||
|
||||
@@ -24,6 +24,7 @@ type Interface interface {
|
||||
SyncRelease(context HelmContext, name, chart, namespace string, flags ...string) error
|
||||
DiffRelease(context HelmContext, name, chart, namespace string, suppressDiff bool, flags ...string) error
|
||||
TemplateRelease(name, chart string, flags ...string) error
|
||||
UnittestRelease(context HelmContext, name, chart string, flags ...string) error
|
||||
Fetch(chart string, flags ...string) error
|
||||
ChartPull(chart string, path string, flags ...string) error
|
||||
ChartExport(chart string, path string) error
|
||||
|
||||
Reference in New Issue
Block a user