From 6bfe4167681a731905a8693be5045caa48208b6a Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Mon, 29 Jul 2024 14:26:52 -0400 Subject: [PATCH 1/6] `cf revisions` no longer reports EXPERIMENTAL notice --- command/v7/revision_command.go | 2 -- command/v7/revision_command_test.go | 4 ++-- command/v7/revisions_command.go | 2 -- command/v7/revisions_command_test.go | 4 ++-- integration/v7/isolated/revision_command_test.go | 2 +- integration/v7/isolated/revisions_command_test.go | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/command/v7/revision_command.go b/command/v7/revision_command.go index ebd429291b4..9c91701dda9 100644 --- a/command/v7/revision_command.go +++ b/command/v7/revision_command.go @@ -1,7 +1,6 @@ package v7 import ( - "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag" ) @@ -14,7 +13,6 @@ type RevisionCommand struct { } func (cmd RevisionCommand) Execute(_ []string) error { - cmd.UI.DisplayWarning(command.ExperimentalWarning) cmd.UI.DisplayNewline() return nil } diff --git a/command/v7/revision_command_test.go b/command/v7/revision_command_test.go index 2b31c71045f..03d5696e738 100644 --- a/command/v7/revision_command_test.go +++ b/command/v7/revision_command_test.go @@ -49,7 +49,7 @@ var _ = Describe("revision Command", func() { Expect(cmd.Execute(nil)).To(Succeed()) }) - It("displays the experimental warning", func() { - Expect(testUI.Err).To(Say("This command is in EXPERIMENTAL stage and may change without notice")) + It("no longer displays the experimental warning", func() { + Expect(testUI.Err).NotTo(Say("This command is in EXPERIMENTAL stage and may change without notice")) }) }) diff --git a/command/v7/revisions_command.go b/command/v7/revisions_command.go index d2b1b87b9b8..92a74ffae0e 100644 --- a/command/v7/revisions_command.go +++ b/command/v7/revisions_command.go @@ -5,7 +5,6 @@ import ( "strconv" "code.cloudfoundry.org/cli/actor/v7action" - "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/ui" @@ -26,7 +25,6 @@ type RevisionsCommand struct { } func (cmd RevisionsCommand) Execute(_ []string) error { - cmd.UI.DisplayWarning(command.ExperimentalWarning) cmd.UI.DisplayNewline() err := cmd.SharedActor.CheckTarget(true, true) diff --git a/command/v7/revisions_command_test.go b/command/v7/revisions_command_test.go index e7a7987ea46..5e11ab1a8d3 100644 --- a/command/v7/revisions_command_test.go +++ b/command/v7/revisions_command_test.go @@ -59,8 +59,8 @@ var _ = Describe("revisions Command", func() { executeErr = cmd.Execute(nil) }) - It("displays the experimental warning", func() { - Expect(testUI.Err).To(Say("This command is in EXPERIMENTAL stage and may change without notice")) + It("no longer displays the experimental warning", func() { + Expect(testUI.Err).NotTo(Say("This command is in EXPERIMENTAL stage and may change without notice")) }) When("checking target fails", func() { diff --git a/integration/v7/isolated/revision_command_test.go b/integration/v7/isolated/revision_command_test.go index 47cf099fc4f..8bd52385be2 100644 --- a/integration/v7/isolated/revision_command_test.go +++ b/integration/v7/isolated/revision_command_test.go @@ -15,7 +15,7 @@ var _ = Describe("revision command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).To(HaveCommandInCategoryWithDescription("revision", "EXPERIMENTAL COMMANDS", "Show details for a specific app revision")) + Expect(session).NotTo(HaveCommandInCategoryWithDescription("revision", "EXPERIMENTAL COMMANDS", "Show details for a specific app revision")) }) It("Displays revision command usage to output", func() { diff --git a/integration/v7/isolated/revisions_command_test.go b/integration/v7/isolated/revisions_command_test.go index c5816d0aa80..e8a013b0981 100644 --- a/integration/v7/isolated/revisions_command_test.go +++ b/integration/v7/isolated/revisions_command_test.go @@ -33,7 +33,7 @@ var _ = Describe("revisions command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).To(HaveCommandInCategoryWithDescription("revisions", "EXPERIMENTAL COMMANDS", "List revisions of an app")) + Expect(session).NotTo(HaveCommandInCategoryWithDescription("revisions", "EXPERIMENTAL COMMANDS", "List revisions of an app")) }) It("Displays command usage to output", func() { From 285c7b3b77c14ea360544c6ddb332361f75ffaac Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Mon, 5 Aug 2024 12:56:47 -0400 Subject: [PATCH 2/6] Move `revision` and `revisions` commands into APPS section of help --- command/common/internal/help_all_display.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/command/common/internal/help_all_display.go b/command/common/internal/help_all_display.go index f2dbcc4c981..d6ae943984c 100644 --- a/command/common/internal/help_all_display.go +++ b/command/common/internal/help_all_display.go @@ -17,6 +17,7 @@ var HelpCategoryList = []HelpCategory{ {"start", "stop", "restart", "stage-package", "restage", "restart-app-instance"}, {"run-task", "tasks", "terminate-task"}, {"packages", "create-package"}, + {"revisions", "revision"}, {"droplets", "set-droplet", "download-droplet"}, {"events", "logs"}, {"env", "set-env", "unset-env"}, @@ -172,7 +173,7 @@ var ExperimentalHelpCategoryList = []HelpCategory{ { CategoryName: "EXPERIMENTAL COMMANDS:", CommandList: [][]string{ - {"revisions", "revision", "rollback"}, + {"rollback"}, }, }, } From 02944a99147608649d2264ec9879a5d0b3053652 Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Mon, 5 Aug 2024 12:57:27 -0400 Subject: [PATCH 3/6] Remove negative assertions for revision commands' experimental status --- command/v7/revision_command_test.go | 55 ------------------- command/v7/revisions_command_test.go | 4 -- .../v7/isolated/revision_command_test.go | 2 +- .../v7/isolated/revisions_command_test.go | 2 +- 4 files changed, 2 insertions(+), 61 deletions(-) delete mode 100644 command/v7/revision_command_test.go diff --git a/command/v7/revision_command_test.go b/command/v7/revision_command_test.go deleted file mode 100644 index 03d5696e738..00000000000 --- a/command/v7/revision_command_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package v7_test - -import ( - "code.cloudfoundry.org/cli/command/commandfakes" - v7 "code.cloudfoundry.org/cli/command/v7" - "code.cloudfoundry.org/cli/command/v7/v7fakes" - "code.cloudfoundry.org/cli/util/ui" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gbytes" -) - -var _ = Describe("revision Command", func() { - var ( - cmd v7.RevisionCommand - testUI *ui.UI - fakeConfig *commandfakes.FakeConfig - fakeSharedActor *commandfakes.FakeSharedActor - fakeActor *v7fakes.FakeActor - binaryName string - appName string - - out *Buffer - ) - - BeforeEach(func() { - out = NewBuffer() - testUI = ui.NewTestUI(nil, out, NewBuffer()) - fakeConfig = new(commandfakes.FakeConfig) - fakeSharedActor = new(commandfakes.FakeSharedActor) - fakeActor = new(v7fakes.FakeActor) - - cmd = v7.RevisionCommand{ - BaseCommand: v7.BaseCommand{ - UI: testUI, - Config: fakeConfig, - SharedActor: fakeSharedActor, - Actor: fakeActor, - }, - } - binaryName = "faceman" - fakeConfig.BinaryNameReturns(binaryName) - appName = "some-app" - - cmd.RequiredArgs.AppName = appName - }) - - JustBeforeEach(func() { - Expect(cmd.Execute(nil)).To(Succeed()) - }) - - It("no longer displays the experimental warning", func() { - Expect(testUI.Err).NotTo(Say("This command is in EXPERIMENTAL stage and may change without notice")) - }) -}) diff --git a/command/v7/revisions_command_test.go b/command/v7/revisions_command_test.go index 5e11ab1a8d3..6af5b8ff3d9 100644 --- a/command/v7/revisions_command_test.go +++ b/command/v7/revisions_command_test.go @@ -59,10 +59,6 @@ var _ = Describe("revisions Command", func() { executeErr = cmd.Execute(nil) }) - It("no longer displays the experimental warning", func() { - Expect(testUI.Err).NotTo(Say("This command is in EXPERIMENTAL stage and may change without notice")) - }) - When("checking target fails", func() { BeforeEach(func() { fakeSharedActor.CheckTargetReturns(actionerror.NotLoggedInError{BinaryName: binaryName}) diff --git a/integration/v7/isolated/revision_command_test.go b/integration/v7/isolated/revision_command_test.go index 8bd52385be2..d3be95545d7 100644 --- a/integration/v7/isolated/revision_command_test.go +++ b/integration/v7/isolated/revision_command_test.go @@ -15,7 +15,7 @@ var _ = Describe("revision command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).NotTo(HaveCommandInCategoryWithDescription("revision", "EXPERIMENTAL COMMANDS", "Show details for a specific app revision")) + Expect(session).To(HaveCommandInCategoryWithDescription("revision", "APPS", "Show details for a specific app revision")) }) It("Displays revision command usage to output", func() { diff --git a/integration/v7/isolated/revisions_command_test.go b/integration/v7/isolated/revisions_command_test.go index e8a013b0981..952654b1b7a 100644 --- a/integration/v7/isolated/revisions_command_test.go +++ b/integration/v7/isolated/revisions_command_test.go @@ -33,7 +33,7 @@ var _ = Describe("revisions command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).NotTo(HaveCommandInCategoryWithDescription("revisions", "EXPERIMENTAL COMMANDS", "List revisions of an app")) + Expect(session).To(HaveCommandInCategoryWithDescription("revisions", "APPS", "List revisions of an app")) }) It("Displays command usage to output", func() { From 7f3a3c25a5bab9daa11e71ac9f34b0d4536729a4 Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Tue, 13 Aug 2024 11:28:46 -0400 Subject: [PATCH 4/6] Restore "revision" command to experimental status --- command/common/internal/help_all_display.go | 4 +- command/v7/revision_command.go | 2 + command/v7/revision_command_test.go | 55 +++++++++++++++++++ .../v7/isolated/revision_command_test.go | 2 +- 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 command/v7/revision_command_test.go diff --git a/command/common/internal/help_all_display.go b/command/common/internal/help_all_display.go index d6ae943984c..5ee07f9093b 100644 --- a/command/common/internal/help_all_display.go +++ b/command/common/internal/help_all_display.go @@ -17,7 +17,7 @@ var HelpCategoryList = []HelpCategory{ {"start", "stop", "restart", "stage-package", "restage", "restart-app-instance"}, {"run-task", "tasks", "terminate-task"}, {"packages", "create-package"}, - {"revisions", "revision"}, + {"revisions"}, {"droplets", "set-droplet", "download-droplet"}, {"events", "logs"}, {"env", "set-env", "unset-env"}, @@ -173,7 +173,7 @@ var ExperimentalHelpCategoryList = []HelpCategory{ { CategoryName: "EXPERIMENTAL COMMANDS:", CommandList: [][]string{ - {"rollback"}, + {"revision", "rollback"}, }, }, } diff --git a/command/v7/revision_command.go b/command/v7/revision_command.go index 9c91701dda9..ebd429291b4 100644 --- a/command/v7/revision_command.go +++ b/command/v7/revision_command.go @@ -1,6 +1,7 @@ package v7 import ( + "code.cloudfoundry.org/cli/command" "code.cloudfoundry.org/cli/command/flag" ) @@ -13,6 +14,7 @@ type RevisionCommand struct { } func (cmd RevisionCommand) Execute(_ []string) error { + cmd.UI.DisplayWarning(command.ExperimentalWarning) cmd.UI.DisplayNewline() return nil } diff --git a/command/v7/revision_command_test.go b/command/v7/revision_command_test.go new file mode 100644 index 00000000000..2b31c71045f --- /dev/null +++ b/command/v7/revision_command_test.go @@ -0,0 +1,55 @@ +package v7_test + +import ( + "code.cloudfoundry.org/cli/command/commandfakes" + v7 "code.cloudfoundry.org/cli/command/v7" + "code.cloudfoundry.org/cli/command/v7/v7fakes" + "code.cloudfoundry.org/cli/util/ui" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gbytes" +) + +var _ = Describe("revision Command", func() { + var ( + cmd v7.RevisionCommand + testUI *ui.UI + fakeConfig *commandfakes.FakeConfig + fakeSharedActor *commandfakes.FakeSharedActor + fakeActor *v7fakes.FakeActor + binaryName string + appName string + + out *Buffer + ) + + BeforeEach(func() { + out = NewBuffer() + testUI = ui.NewTestUI(nil, out, NewBuffer()) + fakeConfig = new(commandfakes.FakeConfig) + fakeSharedActor = new(commandfakes.FakeSharedActor) + fakeActor = new(v7fakes.FakeActor) + + cmd = v7.RevisionCommand{ + BaseCommand: v7.BaseCommand{ + UI: testUI, + Config: fakeConfig, + SharedActor: fakeSharedActor, + Actor: fakeActor, + }, + } + binaryName = "faceman" + fakeConfig.BinaryNameReturns(binaryName) + appName = "some-app" + + cmd.RequiredArgs.AppName = appName + }) + + JustBeforeEach(func() { + Expect(cmd.Execute(nil)).To(Succeed()) + }) + + It("displays the experimental warning", func() { + Expect(testUI.Err).To(Say("This command is in EXPERIMENTAL stage and may change without notice")) + }) +}) diff --git a/integration/v7/isolated/revision_command_test.go b/integration/v7/isolated/revision_command_test.go index d3be95545d7..47cf099fc4f 100644 --- a/integration/v7/isolated/revision_command_test.go +++ b/integration/v7/isolated/revision_command_test.go @@ -15,7 +15,7 @@ var _ = Describe("revision command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).To(HaveCommandInCategoryWithDescription("revision", "APPS", "Show details for a specific app revision")) + Expect(session).To(HaveCommandInCategoryWithDescription("revision", "EXPERIMENTAL COMMANDS", "Show details for a specific app revision")) }) It("Displays revision command usage to output", func() { From 75c27ff89b1d46ca128397c93cd8773cb6588e6b Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Tue, 13 Aug 2024 11:34:58 -0400 Subject: [PATCH 5/6] `cf rollback` no longer reports EXPERIMENTAL status --- command/common/internal/help_all_display.go | 4 ++-- command/v7/rollback_command.go | 3 --- command/v7/rollback_command_test.go | 4 ---- integration/v7/isolated/rollback_command_test.go | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/command/common/internal/help_all_display.go b/command/common/internal/help_all_display.go index 5ee07f9093b..9090f70f46f 100644 --- a/command/common/internal/help_all_display.go +++ b/command/common/internal/help_all_display.go @@ -17,7 +17,7 @@ var HelpCategoryList = []HelpCategory{ {"start", "stop", "restart", "stage-package", "restage", "restart-app-instance"}, {"run-task", "tasks", "terminate-task"}, {"packages", "create-package"}, - {"revisions"}, + {"revisions", "rollback"}, {"droplets", "set-droplet", "download-droplet"}, {"events", "logs"}, {"env", "set-env", "unset-env"}, @@ -173,7 +173,7 @@ var ExperimentalHelpCategoryList = []HelpCategory{ { CategoryName: "EXPERIMENTAL COMMANDS:", CommandList: [][]string{ - {"revision", "rollback"}, + {"revision"}, }, }, } diff --git a/command/v7/rollback_command.go b/command/v7/rollback_command.go index 14854c42a36..29c7c2e7169 100644 --- a/command/v7/rollback_command.go +++ b/command/v7/rollback_command.go @@ -38,9 +38,6 @@ func (cmd *RollbackCommand) Setup(config command.Config, ui command.UI) error { } func (cmd RollbackCommand) Execute(args []string) error { - cmd.UI.DisplayWarning(command.ExperimentalWarning) - cmd.UI.DisplayNewline() - targetRevision := int(cmd.Version.Value) err := cmd.SharedActor.CheckTarget(true, true) if err != nil { diff --git a/command/v7/rollback_command_test.go b/command/v7/rollback_command_test.go index 9edcfc564a9..3218d02a9b6 100644 --- a/command/v7/rollback_command_test.go +++ b/command/v7/rollback_command_test.go @@ -85,10 +85,6 @@ var _ = Describe("rollback Command", func() { executeErr = cmd.Execute(nil) }) - It("displays the experimental warning", func() { - Expect(testUI.Err).To(Say("This command is in EXPERIMENTAL stage and may change without notice")) - }) - When("checking target fails", func() { BeforeEach(func() { fakeSharedActor.CheckTargetReturns(actionerror.NoOrganizationTargetedError{BinaryName: binaryName}) diff --git a/integration/v7/isolated/rollback_command_test.go b/integration/v7/isolated/rollback_command_test.go index 056c2115b9e..3e8bf1eb0cd 100644 --- a/integration/v7/isolated/rollback_command_test.go +++ b/integration/v7/isolated/rollback_command_test.go @@ -21,7 +21,7 @@ var _ = Describe("rollback command", func() { It("appears in cf help -a", func() { session := helpers.CF("help", "-a") Eventually(session).Should(Exit(0)) - Expect(session).To(HaveCommandInCategoryWithDescription("rollback", "EXPERIMENTAL COMMANDS", "Rollback to the specified revision of an app")) + Expect(session).To(HaveCommandInCategoryWithDescription("rollback", "APPS", "Rollback to the specified revision of an app")) }) It("Displays rollback command usage to output", func() { From 0b823902386e93a95d7c33922fb59cca8ac7955e Mon Sep 17 00:00:00 2001 From: Michael Chinigo Date: Tue, 13 Aug 2024 11:38:17 -0400 Subject: [PATCH 6/6] Remove superfluous newline --- command/v7/revisions_command.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/command/v7/revisions_command.go b/command/v7/revisions_command.go index 92a74ffae0e..2c309350b61 100644 --- a/command/v7/revisions_command.go +++ b/command/v7/revisions_command.go @@ -25,8 +25,6 @@ type RevisionsCommand struct { } func (cmd RevisionsCommand) Execute(_ []string) error { - cmd.UI.DisplayNewline() - err := cmd.SharedActor.CheckTarget(true, true) if err != nil { return err