Skip to content

Commit

Permalink
Fix error msg:delete-private-domain shared domain
Browse files Browse the repository at this point in the history
[finishes #162998032]

Authored-by: Piyali Banerjee <pbanerjee@pivotal.io>
  • Loading branch information
piyalibanerjee committed May 2, 2019
1 parent cd2db7f commit 5010c00
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actor/v7action/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (actor Actor) CheckSharedDomain(domainName string) (Warnings, error) {
return allWarnings, err
}
if domain.Shared() {
err = fmt.Errorf("Domain %s is a shared domain, not a private domain.", domainName)
err = fmt.Errorf("Domain '%s' is a shared domain, not a private domain.", domainName)
}

return allWarnings, err
Expand Down
4 changes: 2 additions & 2 deletions actor/v7action/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("Domain Actions", func() {
})

Describe("check if shared domain", func() {
When("deleting attempting to delete a shared domain", func() {
When("attempting to delete a shared domain", func() {
BeforeEach(func() {
fakeCloudControllerClient.GetDomainsReturns(
[]ccv3.Domain{
Expand All @@ -90,7 +90,7 @@ var _ = Describe("Domain Actions", func() {

It("delegates to the cloud controller client", func() {
warnings, executeErr := actor.CheckSharedDomain("the-domain.com")
Expect(executeErr).To(MatchError("Domain the-domain.com is a shared domain, not a private domain."))
Expect(executeErr).To(MatchError("Domain 'the-domain.com' is a shared domain, not a private domain."))
Expect(warnings).To(ConsistOf("get-domains-warning"))
})
})
Expand Down
3 changes: 0 additions & 3 deletions command/v7/delete_private_domain_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ func (cmd DeletePrivateDomainCommand) Execute(args []string) error {
shareCheckWarnings, shareCheckErr := cmd.Actor.CheckSharedDomain(domain)

if shareCheckErr != nil {
cmd.UI.DisplayText("Domain '{{.DomainName}}' is a shared domain, not a private domain.", map[string]interface{}{
"DomainName": domain,
})
cmd.UI.DisplayWarnings(shareCheckWarnings)
return shareCheckErr
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ var _ = Describe("delete-private-domain command", func() {
When("the user attempts to delete-private-domain a shared domain", func() {
It("it fails and provides the appropriate error message", func() {
session := helpers.CFWithStdin(buffer, "delete-private-domain", sharedDomainName)
Eventually(session).Should(Say(`Domain '%s' is a shared domain, not a private domain.`, sharedDomainName))
Eventually(session).Should(Say("FAILED"))
Eventually(session.Err).Should(Say(`Domain '%s' is a shared domain, not a private domain.`, sharedDomainName))

Eventually(session).Should(Exit(1))
})
})
Expand Down

0 comments on commit 5010c00

Please sign in to comment.