Skip to content

Commit

Permalink
Merge branch 'v7'
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Webb <[email protected]>
  • Loading branch information
jpalmerpivotal and nickjameswebb committed Oct 28, 2020
2 parents b8ae09e + cf1618d commit 04fe240
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions command/v7/revisions_command.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v7

import (
"fmt"
"strconv"

"code.cloudfoundry.org/cli/actor/v7action"
Expand Down Expand Up @@ -62,6 +63,11 @@ func (cmd RevisionsCommand) Execute(_ []string) error {
})
}

if app.Stopped() {
cmd.UI.DisplayNewline()
cmd.UI.DisplayText(fmt.Sprintf("Info: this app is in a stopped state. It is not possible to determine which revision is currently deployed."))
}

cmd.UI.DisplayNewline()

revisions, warnings, err := cmd.Actor.GetRevisionsByApplicationNameAndSpace(
Expand Down
19 changes: 19 additions & 0 deletions command/v7/revisions_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v7action"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
"code.cloudfoundry.org/cli/command/commandfakes"
. "code.cloudfoundry.org/cli/command/v7"
v7 "code.cloudfoundry.org/cli/command/v7"
Expand Down Expand Up @@ -189,6 +190,24 @@ var _ = Describe("revisions Command", func() {
Expect(spaceGUID).To(Equal("some-space-guid"))
})

When("the app is in the STOPPED state", func() {
BeforeEach(func() {
fakeApp := resources.Application{
GUID: "fake-guid",
Name: "app-name",
State: constant.ApplicationStopped,
}
fakeActor.GetApplicationByNameAndSpaceReturns(fakeApp, v7action.Warnings{"get-warning-1", "get-warning-2"}, nil)
})

It("displays the revisions with an info message about being unable to determine the deployed revision", func() {
Expect(executeErr).ToNot(HaveOccurred())

Expect(testUI.Out).To(Say(`Getting revisions for app some-app in org some-org / space some-space as banana\.\.\.`))
Expect(testUI.Out).To(Say(`Info: this app is in a stopped state. It is not possible to determine which revision is currently deployed.`))
})

})
})

When("Application Revisions deployed call fails", func() {
Expand Down

0 comments on commit 04fe240

Please sign in to comment.