From 80fe05a6bd662f9b1736f6d2831bdc4192fcbb2f Mon Sep 17 00:00:00 2001 From: Adrian Stobbe Date: Wed, 6 Sep 2023 15:10:01 +0200 Subject: [PATCH] Update cli/internal/cmd/upgradeapply.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> --- cli/internal/cmd/upgradeapply.go | 10 +++++----- cli/internal/cmd/upgradeapply_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/internal/cmd/upgradeapply.go b/cli/internal/cmd/upgradeapply.go index 5a25ede627..4e3d57492e 100644 --- a/cli/internal/cmd/upgradeapply.go +++ b/cli/internal/cmd/upgradeapply.go @@ -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) @@ -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): @@ -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): @@ -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 diff --git a/cli/internal/cmd/upgradeapply_test.go b/cli/internal/cmd/upgradeapply_test.go index 43aef0d164..9e50ca1956 100644 --- a/cli/internal/cmd/upgradeapply_test.go +++ b/cli/internal/cmd/upgradeapply_test.go @@ -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") }) }