Skip to content

Commit

Permalink
Refactor command and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theghost5800 committed Dec 10, 2024
1 parent 1157320 commit 0007bea
Show file tree
Hide file tree
Showing 6 changed files with 494 additions and 157 deletions.
2 changes: 1 addition & 1 deletion commands/blue_green_deploy_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (c *BlueGreenDeployCommand) GetPluginCommand() plugin.Command {
util.GetShortOption(uploadTimeoutOpt): "Upload app timeout in seconds",
util.GetShortOption(taskExecutionTimeoutOpt): "Task execution timeout in seconds",
util.CombineFullAndShortParameters(startTimeoutOpt, timeoutOpt): "Start app timeout in seconds",
util.GetShortOption(shouldPreserveOldApps): "Should preserve old applications (only for blue-green)",
util.GetShortOption(shouldBackupExistingApps): "Should backup existing applications (only for blue-green)",
},
},
}
Expand Down
8 changes: 4 additions & 4 deletions commands/deploy_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (
applyNamespaceAppRoutesOpt = "apply-namespace-app-routes"
applyNamespaceAsSuffix = "apply-namespace-as-suffix"
maxNamespaceSize = 36
shouldPreserveOldApps = "preserve-old-apps"
shouldBackupExistingApps = "backup-existing-apps"
)

type listFlag struct {
Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *DeployCommand) GetPluginCommand() plugin.Command {
util.GetShortOption(uploadTimeoutOpt): "Upload app timeout in seconds",
util.GetShortOption(taskExecutionTimeoutOpt): "Task execution timeout in seconds",
util.CombineFullAndShortParameters(startTimeoutOpt, timeoutOpt): "Start app timeout in seconds",
util.GetShortOption(shouldPreserveOldApps): "Should preserve old applications (only for blue-green)",
util.GetShortOption(shouldBackupExistingApps): "Should backup existing applications (only for blue-green)",
},
},
}
Expand All @@ -172,7 +172,7 @@ func deployProcessParametersSetter() ProcessParametersSetter {
processBuilder.Parameter("appsStageTimeout", GetStringOpt(stageTimeoutOpt, flags))
processBuilder.Parameter("appsUploadTimeout", GetStringOpt(uploadTimeoutOpt, flags))
processBuilder.Parameter("appsTaskExecutionTimeout", GetStringOpt(taskExecutionTimeoutOpt, flags))
processBuilder.Parameter("shouldPreserveOldApps", strconv.FormatBool(GetBoolOpt(shouldPreserveOldApps, flags)))
processBuilder.Parameter("shouldBackupExistingApps", strconv.FormatBool(GetBoolOpt(shouldBackupExistingApps, flags)))

var lastSetValue string = ""
for i := 0; i < len(os.Args); i++ {
Expand Down Expand Up @@ -226,7 +226,7 @@ func (c *DeployCommand) defineCommandOptions(flags *flag.FlagSet) {
flags.String(stageTimeoutOpt, "", "")
flags.String(uploadTimeoutOpt, "", "")
flags.String(taskExecutionTimeoutOpt, "", "")
flags.Bool(shouldPreserveOldApps, false, "")
flags.Bool(shouldBackupExistingApps, false, "")
}

func (c *DeployCommand) executeInternal(positionalArgs []string, dsHost string, flags *flag.FlagSet, cfTarget util.CloudFoundryTarget) ExecutionStatus {
Expand Down
151 changes: 0 additions & 151 deletions commands/revert_deploy_command.go

This file was deleted.

Loading

0 comments on commit 0007bea

Please sign in to comment.