Put HelmCommand in Help, not run.Config [#15]
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
|
||||
// Config contains configuration applicable to all helm commands
|
||||
type Config struct {
|
||||
HelmCommand string
|
||||
Debug bool
|
||||
Values string
|
||||
StringValues string
|
||||
|
||||
@@ -6,7 +6,8 @@ import (
|
||||
|
||||
// Help is a step in a helm Plan that calls `helm help`.
|
||||
type Help struct {
|
||||
cmd cmd
|
||||
HelmCommand string
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Execute executes the `helm help` command.
|
||||
@@ -15,10 +16,10 @@ func (h *Help) Execute(cfg Config) error {
|
||||
return fmt.Errorf("while running '%s': %w", h.cmd.String(), err)
|
||||
}
|
||||
|
||||
if cfg.HelmCommand == "help" {
|
||||
if h.HelmCommand == "help" {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown command '%s'", cfg.HelmCommand)
|
||||
return fmt.Errorf("unknown command '%s'", h.HelmCommand)
|
||||
}
|
||||
|
||||
// Prepare gets the Help ready to execute.
|
||||
|
||||
@@ -63,15 +63,14 @@ func (suite *HelpTestSuite) TestExecute() {
|
||||
Run().
|
||||
Times(2)
|
||||
|
||||
cfg := Config{
|
||||
HelmCommand: "help",
|
||||
}
|
||||
cfg := Config{}
|
||||
help := Help{
|
||||
cmd: mCmd,
|
||||
HelmCommand: "help",
|
||||
cmd: mCmd,
|
||||
}
|
||||
suite.NoError(help.Execute(cfg))
|
||||
|
||||
cfg.HelmCommand = "get down on friday"
|
||||
help.HelmCommand = "get down on friday"
|
||||
suite.EqualError(help.Execute(cfg), "unknown command 'get down on friday'")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user