Implement the various values flags in lint [#3]
This commit is contained in:
parent
991bbf97b4
commit
51800c18d7
|
@ -18,7 +18,19 @@ func (l *Lint) Execute(_ Config) error {
|
|||
|
||||
// Prepare gets the Lint ready to execute.
|
||||
func (l *Lint) Prepare(cfg Config) error {
|
||||
args := []string{"lint", l.Chart}
|
||||
args := []string{"lint"}
|
||||
|
||||
if cfg.Values != "" {
|
||||
args = append(args, "--set", cfg.Values)
|
||||
}
|
||||
if cfg.StringValues != "" {
|
||||
args = append(args, "--set-string", cfg.StringValues)
|
||||
}
|
||||
for _, vFile := range cfg.ValuesFiles {
|
||||
args = append(args, "--values", vFile)
|
||||
}
|
||||
|
||||
args = append(args, l.Chart)
|
||||
|
||||
l.cmd = command(helmBin, args...)
|
||||
l.cmd.Stdout(cfg.Stdout)
|
||||
|
|
|
@ -56,3 +56,35 @@ func (suite *LintTestSuite) TestPrepareAndExecute() {
|
|||
suite.Require().Nil(err)
|
||||
l.Execute(cfg)
|
||||
}
|
||||
|
||||
func (suite *LintTestSuite) TestPrepareWithLintFlags() {
|
||||
defer suite.ctrl.Finish()
|
||||
|
||||
cfg := Config{
|
||||
Values: "width=5",
|
||||
StringValues: "version=2.0",
|
||||
ValuesFiles: []string{"/usr/local/underrides", "/usr/local/overrides"},
|
||||
}
|
||||
|
||||
l := Lint{
|
||||
Chart: "./uk/top_40",
|
||||
}
|
||||
|
||||
command = func(path string, args ...string) cmd {
|
||||
suite.Equal(helmBin, path)
|
||||
suite.Equal([]string{"lint",
|
||||
"--set", "width=5",
|
||||
"--set-string", "version=2.0",
|
||||
"--values", "/usr/local/underrides",
|
||||
"--values", "/usr/local/overrides",
|
||||
"./uk/top_40"}, args)
|
||||
|
||||
return suite.mockCmd
|
||||
}
|
||||
|
||||
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
||||
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
||||
|
||||
err := l.Prepare(cfg)
|
||||
suite.Require().Nil(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue