Pass --keep-history when so instructed [#24]
This commit is contained in:
@@ -6,9 +6,10 @@ import (
|
||||
|
||||
// Uninstall is an execution step that calls `helm uninstall` when executed.
|
||||
type Uninstall struct {
|
||||
Release string
|
||||
DryRun bool
|
||||
cmd cmd
|
||||
Release string
|
||||
DryRun bool
|
||||
KeepHistory bool
|
||||
cmd cmd
|
||||
}
|
||||
|
||||
// Execute executes the `helm uninstall` command.
|
||||
@@ -36,6 +37,9 @@ func (u *Uninstall) Prepare(cfg Config) error {
|
||||
if u.DryRun {
|
||||
args = append(args, "--dry-run")
|
||||
}
|
||||
if u.KeepHistory {
|
||||
args = append(args, "--keep-history")
|
||||
}
|
||||
|
||||
args = append(args, u.Release)
|
||||
|
||||
|
||||
@@ -81,6 +81,21 @@ func (suite *UninstallTestSuite) TestPrepareDryRunFlag() {
|
||||
suite.Equal(expected, suite.actualArgs)
|
||||
}
|
||||
|
||||
func (suite *UninstallTestSuite) TestPrepareKeepHistoryFlag() {
|
||||
u := Uninstall{
|
||||
Release: "perturbator_sentient",
|
||||
KeepHistory: true,
|
||||
}
|
||||
cfg := Config{}
|
||||
|
||||
suite.mockCmd.EXPECT().Stdout(gomock.Any()).AnyTimes()
|
||||
suite.mockCmd.EXPECT().Stderr(gomock.Any()).AnyTimes()
|
||||
|
||||
suite.NoError(u.Prepare(cfg))
|
||||
expected := []string{"uninstall", "--keep-history", "perturbator_sentient"}
|
||||
suite.Equal(expected, suite.actualArgs)
|
||||
}
|
||||
|
||||
func (suite *UninstallTestSuite) TestPrepareNamespaceFlag() {
|
||||
u := Uninstall{
|
||||
Release: "carly_simon_run_away_with_me",
|
||||
|
||||
Reference in New Issue
Block a user