Rename Delete to Uninstall [#4]

Helm3 renamed its delete command to uninstall. We should still accept
helm_command=delete for drone-helm compatibility, but the internals
should use Helm's preferred name.
This commit is contained in:
Erin Call
2019-12-19 15:02:49 -08:00
parent f373004bd2
commit 161960e55e
5 changed files with 98 additions and 89 deletions

View File

@@ -59,8 +59,8 @@ func determineSteps(cfg Config) *func(Config) []Step {
switch cfg.Command {
case "upgrade":
return &upgrade
case "delete":
return &del
case "uninstall", "delete":
return &uninstall
case "lint":
return &lint
case "help":
@@ -70,7 +70,7 @@ func determineSteps(cfg Config) *func(Config) []Step {
case "push", "tag", "deployment", "pull_request", "promote", "rollback":
return &upgrade
case "delete":
return &del
return &uninstall
default:
panic("not implemented")
}
@@ -109,9 +109,9 @@ var upgrade = func(cfg Config) []Step {
return steps
}
var del = func(cfg Config) []Step {
var uninstall = func(cfg Config) []Step {
steps := initKube(cfg)
steps = append(steps, &run.Delete{
steps = append(steps, &run.Uninstall{
Release: cfg.Release,
DryRun: cfg.DryRun,
})

View File

@@ -130,8 +130,8 @@ func (suite *PlanTestSuite) TestDel() {
Release: "jetta_id_love_to_change_the_world",
}
steps := del(cfg)
suite.Require().Equal(2, len(steps), "del should return 2 steps")
steps := uninstall(cfg)
suite.Require().Equal(2, len(steps), "uninstall should return 2 steps")
suite.Require().IsType(&run.InitKube{}, steps[0])
init, _ := steps[0].(*run.InitKube)
@@ -146,9 +146,9 @@ func (suite *PlanTestSuite) TestDel() {
suite.Equal(expected, init)
suite.Require().IsType(&run.Delete{}, steps[1])
actual, _ := steps[1].(*run.Delete)
expected = &run.Delete{
suite.Require().IsType(&run.Uninstall{}, steps[1])
actual, _ := steps[1].(*run.Uninstall)
expected = &run.Uninstall{
Release: "jetta_id_love_to_change_the_world",
DryRun: true,
}
@@ -213,12 +213,21 @@ func (suite *PlanTestSuite) TestDeterminePlanUpgradeFromDroneEvent() {
}
}
func (suite *PlanTestSuite) TestDeterminePlanUninstallCommand() {
cfg := Config{
Command: "uninstall",
}
stepsMaker := determineSteps(cfg)
suite.Same(&uninstall, stepsMaker)
}
// helm_command = delete is provided as an alias for backwards-compatibility with drone-helm
func (suite *PlanTestSuite) TestDeterminePlanDeleteCommand() {
cfg := Config{
Command: "delete",
}
stepsMaker := determineSteps(cfg)
suite.Same(&del, stepsMaker)
suite.Same(&uninstall, stepsMaker)
}
func (suite *PlanTestSuite) TestDeterminePlanDeleteFromDroneEvent() {
@@ -226,7 +235,7 @@ func (suite *PlanTestSuite) TestDeterminePlanDeleteFromDroneEvent() {
DroneEvent: "delete",
}
stepsMaker := determineSteps(cfg)
suite.Same(&del, stepsMaker)
suite.Same(&uninstall, stepsMaker)
}
func (suite *PlanTestSuite) TestDeterminePlanLintCommand() {