mirror of
https://github.com/helm/chart-testing.git
synced 2026-02-05 09:45:14 +01:00
add helm lint extra args (#605)
Signed-off-by: cpanato <ctadeu@gmail.com>
This commit is contained in:
committed by
GitHub
parent
0cb17e5aa8
commit
a67573475c
@@ -259,11 +259,12 @@ type TestResult struct {
|
||||
// NewTesting creates a new Testing struct with the given config.
|
||||
func NewTesting(config config.Configuration, extraSetArgs string) (Testing, error) {
|
||||
procExec := exec.NewProcessExecutor(config.Debug)
|
||||
extraArgs := strings.Fields(config.HelmExtraArgs)
|
||||
helmExtraArgs := strings.Fields(config.HelmExtraArgs)
|
||||
helmLintExtraArgs := strings.Fields(config.HelmLintExtraArgs)
|
||||
|
||||
testing := Testing{
|
||||
config: config,
|
||||
helm: tool.NewHelm(procExec, extraArgs, strings.Fields(extraSetArgs)),
|
||||
helm: tool.NewHelm(procExec, helmExtraArgs, helmLintExtraArgs, strings.Fields(extraSetArgs)),
|
||||
git: tool.NewGit(procExec),
|
||||
kubectl: tool.NewKubectl(procExec, config.KubectlTimeout),
|
||||
linter: tool.NewLinter(procExec),
|
||||
|
||||
@@ -34,6 +34,8 @@ func newTestingHelmIntegration(cfg config.Configuration, extraSetArgs string) Te
|
||||
fakeMockLinter := new(fakeLinter)
|
||||
procExec := exec.NewProcessExecutor(true)
|
||||
extraArgs := strings.Fields(cfg.HelmExtraArgs)
|
||||
extraLintArgs := strings.Fields(cfg.HelmLintExtraArgs)
|
||||
|
||||
return Testing{
|
||||
config: cfg,
|
||||
directoryLister: util.DirectoryLister{},
|
||||
@@ -41,7 +43,7 @@ func newTestingHelmIntegration(cfg config.Configuration, extraSetArgs string) Te
|
||||
utils: util.Utils{},
|
||||
accountValidator: fakeAccountValidator{},
|
||||
linter: fakeMockLinter,
|
||||
helm: tool.NewHelm(procExec, extraArgs, strings.Fields(extraSetArgs)),
|
||||
helm: tool.NewHelm(procExec, extraArgs, extraLintArgs, strings.Fields(extraSetArgs)),
|
||||
kubectl: tool.NewKubectl(procExec, 30*time.Second),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ type Configuration struct {
|
||||
ChartDirs []string `mapstructure:"chart-dirs"`
|
||||
ExcludedCharts []string `mapstructure:"excluded-charts"`
|
||||
HelmExtraArgs string `mapstructure:"helm-extra-args"`
|
||||
HelmLintExtraArgs string `mapstructure:"helm-lint-extra-args"`
|
||||
HelmRepoExtraArgs []string `mapstructure:"helm-repo-extra-args"`
|
||||
HelmDependencyExtraArgs []string `mapstructure:"helm-dependency-extra-args"`
|
||||
Debug bool `mapstructure:"debug"`
|
||||
|
||||
@@ -52,7 +52,8 @@ func loadAndAssertConfigFromFile(t *testing.T, configFile string) {
|
||||
require.Equal(t, []string{"incubator=--username test"}, cfg.HelmRepoExtraArgs)
|
||||
require.Equal(t, []string{"stable", "incubator"}, cfg.ChartDirs)
|
||||
require.Equal(t, []string{"common"}, cfg.ExcludedCharts)
|
||||
require.Equal(t, "--timeout 300", cfg.HelmExtraArgs)
|
||||
require.Equal(t, "--timeout 300s", cfg.HelmExtraArgs)
|
||||
require.Equal(t, "--quiet", cfg.HelmLintExtraArgs)
|
||||
require.Equal(t, true, cfg.Upgrade)
|
||||
require.Equal(t, true, cfg.SkipMissingValues)
|
||||
require.Equal(t, "default", cfg.Namespace)
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
"excluded-charts": [
|
||||
"common"
|
||||
],
|
||||
"helm-extra-args": "--timeout 300",
|
||||
"helm-extra-args": "--timeout 300s",
|
||||
"helm-lint-extra-args": "--quiet",
|
||||
"upgrade": true,
|
||||
"skip-missing-values": true,
|
||||
"namespace": "default",
|
||||
|
||||
@@ -19,7 +19,8 @@ chart-dirs:
|
||||
- incubator
|
||||
excluded-charts:
|
||||
- common
|
||||
helm-extra-args: --timeout 300
|
||||
helm-extra-args: --timeout 300s
|
||||
helm-lint-extra-args: --quiet
|
||||
upgrade: true
|
||||
skip-missing-values: true
|
||||
namespace: default
|
||||
|
||||
@@ -22,16 +22,18 @@ import (
|
||||
)
|
||||
|
||||
type Helm struct {
|
||||
exec exec.ProcessExecutor
|
||||
extraArgs []string
|
||||
extraSetArgs []string
|
||||
exec exec.ProcessExecutor
|
||||
extraArgs []string
|
||||
lintExtraArgs []string
|
||||
extraSetArgs []string
|
||||
}
|
||||
|
||||
func NewHelm(exec exec.ProcessExecutor, extraArgs []string, extraSetArgs []string) Helm {
|
||||
func NewHelm(exec exec.ProcessExecutor, extraArgs, lintExtraArgs, extraSetArgs []string) Helm {
|
||||
return Helm{
|
||||
exec: exec,
|
||||
extraArgs: extraArgs,
|
||||
extraSetArgs: extraSetArgs,
|
||||
exec: exec,
|
||||
extraArgs: extraArgs,
|
||||
lintExtraArgs: lintExtraArgs,
|
||||
extraSetArgs: extraSetArgs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ func (h Helm) LintWithValues(chart string, valuesFile string) error {
|
||||
values = []string{"--values", valuesFile}
|
||||
}
|
||||
|
||||
return h.exec.RunProcess("helm", "lint", chart, values, h.extraArgs)
|
||||
return h.exec.RunProcess("helm", "lint", chart, values, h.lintExtraArgs)
|
||||
}
|
||||
|
||||
func (h Helm) InstallWithValues(chart string, valuesFile string, namespace string, release string) error {
|
||||
|
||||
Reference in New Issue
Block a user