CleanupOnFail option for the upgrade Step [#65]

This commit is contained in:
Erin Call 2020-01-07 12:53:55 -08:00
parent e071d23fef
commit 8c6c6fbfa5
No known key found for this signature in database
GPG key ID: 4071FF6C15B8DAD1
2 changed files with 28 additions and 22 deletions

View file

@ -9,16 +9,17 @@ type Upgrade struct {
Chart string
Release string
ChartVersion string
DryRun bool
Wait bool
Values string
StringValues string
ValuesFiles []string
ReuseValues bool
Timeout string
Force bool
Atomic bool
ChartVersion string
DryRun bool
Wait bool
Values string
StringValues string
ValuesFiles []string
ReuseValues bool
Timeout string
Force bool
Atomic bool
CleanupOnFail bool
cmd cmd
}
@ -69,6 +70,9 @@ func (u *Upgrade) Prepare(cfg Config) error {
if u.Atomic {
args = append(args, "--atomic")
}
if u.CleanupOnFail {
args = append(args, "--cleanup-on-fail")
}
if u.Values != "" {
args = append(args, "--set", u.Values)
}

View file

@ -89,18 +89,19 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
defer suite.ctrl.Finish()
u := Upgrade{
Chart: "hot_ac",
Release: "maroon_5_memories",
ChartVersion: "radio_edit",
DryRun: true,
Wait: true,
Values: "age=35",
StringValues: "height=5ft10in",
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
ReuseValues: true,
Timeout: "sit_in_the_corner",
Force: true,
Atomic: true,
Chart: "hot_ac",
Release: "maroon_5_memories",
ChartVersion: "radio_edit",
DryRun: true,
Wait: true,
Values: "age=35",
StringValues: "height=5ft10in",
ValuesFiles: []string{"/usr/local/stats", "/usr/local/grades"},
ReuseValues: true,
Timeout: "sit_in_the_corner",
Force: true,
Atomic: true,
CleanupOnFail: true,
}
cfg := Config{}
@ -115,6 +116,7 @@ func (suite *UpgradeTestSuite) TestPrepareWithUpgradeFlags() {
"--timeout", "sit_in_the_corner",
"--force",
"--atomic",
"--cleanup-on-fail",
"--set", "age=35",
"--set-string", "height=5ft10in",
"--values", "/usr/local/stats",