Skip to content

Commit

Permalink
Update cli/internal/cmd/upgradeapply.go
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Weiße <[email protected]>
  • Loading branch information
elchead and daniel-weisse committed Sep 6, 2023
1 parent fb19e33 commit 80fe05a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cli/internal/cmd/upgradeapply.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (u *upgradeApplyCmd) upgradeApply(cmd *cobra.Command, upgradeDir string, fl
}

var tfOutput terraform.ApplyOutput
if flags.skipPhases.Contains(skipInfrastructurePhase) {
if flags.skipPhases.contains(skipInfrastructurePhase) {
tfOutput, err = u.clusterShower.ShowCluster(cmd.Context(), conf.GetProvider())
if err != nil {
return fmt.Errorf("getting Terraform output: %w", err)
Expand Down Expand Up @@ -221,7 +221,7 @@ func (u *upgradeApplyCmd) upgradeApply(cmd *cobra.Command, upgradeDir string, fl
}

var upgradeErr *compatibility.InvalidUpgradeError
if !flags.skipPhases.Contains(skipHelmPhase) {
if !flags.skipPhases.contains(skipHelmPhase) {
err = u.handleServiceUpgrade(cmd, conf, idFile, tfOutput, validK8sVersion, upgradeDir, flags)
switch {
case errors.As(err, &upgradeErr):
Expand All @@ -233,7 +233,7 @@ func (u *upgradeApplyCmd) upgradeApply(cmd *cobra.Command, upgradeDir string, fl
}
}

if !flags.skipPhases.Contains(skipNodePhase) {
if !flags.skipPhases.contains(skipNodePhase) {
err = u.kubeUpgrader.UpgradeNodeVersion(cmd.Context(), conf, flags.force)
switch {
case errors.Is(err, kubecmd.ErrInProgress):
Expand Down Expand Up @@ -600,8 +600,8 @@ type upgradeApplyFlags struct {
// skipPhases is a list of phases that can be skipped during the upgrade process.
type skipPhases []skipPhase

// Contains returns true if the list of phases contains the given phase.
func (s skipPhases) Contains(phase skipPhase) bool {
// contains returns true if the list of phases contains the given phase.
func (s skipPhases) contains(phase skipPhase) bool {
for _, p := range s {
if strings.EqualFold(string(p), string(phase)) {
return true
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmd/upgradeapply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestUpgradeApply(t *testing.T) {
return
}
assert.NoError(err)
assert.Equal(!tc.flags.skipPhases.Contains(skipNodePhase), tc.kubeUpgrader.calledNodeUpgrade,
assert.Equal(!tc.flags.skipPhases.contains(skipNodePhase), tc.kubeUpgrader.calledNodeUpgrade,
"incorrect node upgrade skipping behavior")
})
}
Expand Down

0 comments on commit 80fe05a

Please sign in to comment.