Add the --namespace flag in Lint.Prepare [#3]
I don't know whether this is necessary; I'm just following drone-helm's lead. At worst, helm will accept the flag, so it's at least *safe* to include.
This commit is contained in:
parent
7e24756ad8
commit
84ac019838
|
@ -24,6 +24,9 @@ func (l *Lint) Prepare(cfg Config) error {
|
||||||
|
|
||||||
args := make([]string, 0)
|
args := make([]string, 0)
|
||||||
|
|
||||||
|
if cfg.Namespace != "" {
|
||||||
|
args = append(args, "--namespace", cfg.Namespace)
|
||||||
|
}
|
||||||
if cfg.Debug {
|
if cfg.Debug {
|
||||||
args = append(args, "--debug")
|
args = append(args, "--debug")
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,3 +134,30 @@ func (suite *LintTestSuite) TestPrepareWithDebugFlag() {
|
||||||
want := fmt.Sprintf("Generated command: '%s --debug lint ./scotland/top_40'\n", helmBin)
|
want := fmt.Sprintf("Generated command: '%s --debug lint ./scotland/top_40'\n", helmBin)
|
||||||
suite.Equal(want, stderr.String())
|
suite.Equal(want, stderr.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *LintTestSuite) TestPrepareWithNamespaceFlag() {
|
||||||
|
defer suite.ctrl.Finish()
|
||||||
|
|
||||||
|
cfg := Config{
|
||||||
|
Namespace: "table-service",
|
||||||
|
}
|
||||||
|
|
||||||
|
l := Lint{
|
||||||
|
Chart: "./wales/top_40",
|
||||||
|
}
|
||||||
|
|
||||||
|
actual := []string{}
|
||||||
|
command = func(path string, args ...string) cmd {
|
||||||
|
actual = args
|
||||||
|
return suite.mockCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
suite.mockCmd.EXPECT().Stdout(gomock.Any())
|
||||||
|
suite.mockCmd.EXPECT().Stderr(gomock.Any())
|
||||||
|
|
||||||
|
err := l.Prepare(cfg)
|
||||||
|
suite.Require().Nil(err)
|
||||||
|
|
||||||
|
expected := []string{"--namespace", "table-service", "lint", "./wales/top_40"}
|
||||||
|
suite.Equal(expected, actual)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue