github.com/loafoe/cli@v7.1.0+incompatible/command/v6/service_command_test.go (about) 1 package v6_test 2 3 import ( 4 "errors" 5 6 "code.cloudfoundry.org/cli/actor/actionerror" 7 "code.cloudfoundry.org/cli/actor/v2action" 8 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv2" 9 "code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant" 10 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 11 "code.cloudfoundry.org/cli/command/commandfakes" 12 . "code.cloudfoundry.org/cli/command/v6" 13 "code.cloudfoundry.org/cli/command/v6/v6fakes" 14 "code.cloudfoundry.org/cli/util/configv3" 15 "code.cloudfoundry.org/cli/util/ui" 16 . "github.com/onsi/ginkgo" 17 . "github.com/onsi/gomega" 18 . "github.com/onsi/gomega/gbytes" 19 ) 20 21 var _ = Describe("service Command", func() { 22 var ( 23 cmd ServiceCommand 24 testUI *ui.UI 25 fakeConfig *commandfakes.FakeConfig 26 fakeSharedActor *commandfakes.FakeSharedActor 27 fakeActor *v6fakes.FakeServiceActor 28 binaryName string 29 executeErr error 30 ) 31 32 BeforeEach(func() { 33 testUI = ui.NewTestUI(nil, NewBuffer(), NewBuffer()) 34 fakeConfig = new(commandfakes.FakeConfig) 35 fakeSharedActor = new(commandfakes.FakeSharedActor) 36 fakeActor = new(v6fakes.FakeServiceActor) 37 38 cmd = ServiceCommand{ 39 UI: testUI, 40 Config: fakeConfig, 41 SharedActor: fakeSharedActor, 42 Actor: fakeActor, 43 } 44 45 binaryName = "faceman" 46 fakeConfig.BinaryNameReturns(binaryName) 47 48 cmd.RequiredArgs.ServiceInstance = "some-service-instance" 49 50 fakeActor.CloudControllerAPIVersionReturns(ccversion.MinVersionMaintenanceInfoInSummaryV2) 51 }) 52 53 JustBeforeEach(func() { 54 executeErr = cmd.Execute(nil) 55 }) 56 57 When("an error is encountered checking if the environment is setup correctly", func() { 58 BeforeEach(func() { 59 fakeSharedActor.CheckTargetReturns(actionerror.NotLoggedInError{BinaryName: binaryName}) 60 }) 61 62 It("returns an error", func() { 63 Expect(executeErr).To(MatchError(actionerror.NotLoggedInError{BinaryName: binaryName})) 64 65 Expect(fakeSharedActor.CheckTargetCallCount()).To(Equal(1)) 66 checkTargetedOrgArg, checkTargetedSpaceArg := fakeSharedActor.CheckTargetArgsForCall(0) 67 Expect(checkTargetedOrgArg).To(BeTrue()) 68 Expect(checkTargetedSpaceArg).To(BeTrue()) 69 }) 70 }) 71 72 When("the user is logged in and an org and space are targeted", func() { 73 BeforeEach(func() { 74 fakeConfig.TargetedOrganizationReturns(configv3.Organization{ 75 Name: "some-org", 76 }) 77 fakeConfig.TargetedSpaceReturns(configv3.Space{ 78 GUID: "some-space-guid", 79 Name: "some-space", 80 }) 81 }) 82 83 When("getting the current user fails", func() { 84 BeforeEach(func() { 85 fakeConfig.CurrentUserReturns(configv3.User{}, errors.New("get-user-error")) 86 }) 87 88 It("returns the error", func() { 89 Expect(executeErr).To(MatchError("get-user-error")) 90 Expect(fakeConfig.CurrentUserCallCount()).To(Equal(1)) 91 }) 92 }) 93 94 When("getting the current user succeeds", func() { 95 BeforeEach(func() { 96 fakeConfig.CurrentUserReturns(configv3.User{Name: "some-user"}, nil) 97 }) 98 99 When("the '--guid' flag is provided", func() { 100 BeforeEach(func() { 101 cmd.GUID = true 102 }) 103 104 When("the service instance does not exist", func() { 105 BeforeEach(func() { 106 fakeActor.GetServiceInstanceByNameAndSpaceReturns( 107 v2action.ServiceInstance{}, 108 v2action.Warnings{"get-service-instance-warning"}, 109 actionerror.ServiceInstanceNotFoundError{ 110 GUID: "non-existant-service-instance-guid", 111 Name: "non-existant-service-instance", 112 }) 113 }) 114 115 It("returns ServiceInstanceNotFoundError", func() { 116 Expect(executeErr).To(MatchError(actionerror.ServiceInstanceNotFoundError{ 117 GUID: "non-existant-service-instance-guid", 118 Name: "non-existant-service-instance", 119 })) 120 121 Expect(testUI.Err).To(Say("get-service-instance-warning")) 122 123 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(1)) 124 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceByNameAndSpaceArgsForCall(0) 125 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 126 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 127 128 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(0)) 129 }) 130 }) 131 132 When("an error is encountered getting the service instance", func() { 133 var expectedErr error 134 135 BeforeEach(func() { 136 expectedErr = errors.New("get-service-instance-error") 137 fakeActor.GetServiceInstanceByNameAndSpaceReturns( 138 v2action.ServiceInstance{}, 139 v2action.Warnings{"get-service-instance-warning"}, 140 expectedErr, 141 ) 142 }) 143 144 It("returns the error", func() { 145 Expect(executeErr).To(MatchError(expectedErr)) 146 147 Expect(testUI.Err).To(Say("get-service-instance-warning")) 148 149 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(1)) 150 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceByNameAndSpaceArgsForCall(0) 151 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 152 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 153 154 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(0)) 155 }) 156 }) 157 158 When("no errors are encountered getting the service instance", func() { 159 BeforeEach(func() { 160 fakeActor.GetServiceInstanceByNameAndSpaceReturns( 161 v2action.ServiceInstance{ 162 GUID: "some-service-instance-guid", 163 Name: "some-service-instance", 164 }, 165 v2action.Warnings{"get-service-instance-warning"}, 166 nil, 167 ) 168 }) 169 170 It("displays the service instance guid", func() { 171 Expect(executeErr).ToNot(HaveOccurred()) 172 173 Expect(testUI.Out).To(Say("some-service-instance-guid")) 174 Expect(testUI.Err).To(Say("get-service-instance-warning")) 175 176 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(1)) 177 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceByNameAndSpaceArgsForCall(0) 178 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 179 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 180 181 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(0)) 182 }) 183 }) 184 }) 185 186 When("the '--guid' flag is not provided", func() { 187 When("the service instance does not exist", func() { 188 BeforeEach(func() { 189 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 190 v2action.ServiceInstanceSummary{}, 191 v2action.Warnings{"get-service-instance-summary-warning"}, 192 actionerror.ServiceInstanceNotFoundError{ 193 GUID: "non-existant-service-instance-guid", 194 Name: "non-existant-service-instance", 195 }) 196 }) 197 198 It("returns ServiceInstanceNotFoundError", func() { 199 Expect(executeErr).To(MatchError(actionerror.ServiceInstanceNotFoundError{ 200 GUID: "non-existant-service-instance-guid", 201 Name: "non-existant-service-instance", 202 })) 203 204 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 205 206 Expect(testUI.Err).To(Say("get-service-instance-summary-warning")) 207 208 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 209 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 210 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 211 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 212 213 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 214 }) 215 }) 216 217 When("an error is encountered getting the service instance summary", func() { 218 var expectedErr error 219 220 BeforeEach(func() { 221 expectedErr = errors.New("get-service-instance-summary-error") 222 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 223 v2action.ServiceInstanceSummary{}, 224 v2action.Warnings{"get-service-instance-summary-warning"}, 225 expectedErr) 226 }) 227 228 It("returns the error", func() { 229 Expect(executeErr).To(MatchError(expectedErr)) 230 231 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 232 233 Expect(testUI.Err).To(Say("get-service-instance-summary-warning")) 234 235 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 236 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 237 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 238 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 239 240 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 241 }) 242 }) 243 244 When("no errors are encountered getting the service instance summary", func() { 245 When("the service instance is a managed service instance", func() { 246 var returnedSummary v2action.ServiceInstanceSummary 247 248 BeforeEach(func() { 249 returnedSummary = v2action.ServiceInstanceSummary{ 250 ServiceInstance: v2action.ServiceInstance{ 251 Name: "some-service-instance", 252 Type: constant.ManagedService, 253 Tags: []string{"tag-1", "tag-2", "tag-3"}, 254 DashboardURL: "some-dashboard", 255 LastOperation: ccv2.LastOperation{ 256 Type: "some-type", 257 State: "some-state", 258 Description: "some-last-operation-description", 259 UpdatedAt: "some-updated-at-time", 260 CreatedAt: "some-created-at-time", 261 }, 262 }, 263 ServicePlan: v2action.ServicePlan{ 264 Name: "some-plan", 265 }, 266 Service: v2action.Service{ 267 Label: "some-service", 268 Description: "some-description", 269 DocumentationURL: "some-docs-url", 270 }, 271 } 272 273 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 274 returnedSummary, 275 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 276 nil, 277 ) 278 }) 279 280 When("the service instance is not shared and is not shareable", func() { 281 BeforeEach(func() { 282 returnedSummary.ServiceInstanceShareType = v2action.ServiceInstanceIsNotShared 283 returnedSummary.Service.Extra.Shareable = false 284 returnedSummary.Service.ServiceBrokerName = "broker-1" 285 returnedSummary.BoundApplications = []v2action.BoundApplication{ 286 { 287 AppName: "app-1", 288 ServiceBindingName: "binding-name-1", 289 }, 290 { 291 AppName: "app-2", 292 ServiceBindingName: "binding-name-2", 293 LastOperation: v2action.LastOperation{ 294 Type: "delete", 295 State: constant.LastOperationInProgress, 296 Description: "10% complete", 297 UpdatedAt: "some-updated-at-time", 298 CreatedAt: "some-created-at-time", 299 }, 300 }, 301 { 302 AppName: "app-3", 303 ServiceBindingName: "binding-name-3", 304 LastOperation: v2action.LastOperation{ 305 Type: "create", 306 State: constant.LastOperationFailed, 307 Description: "Binding failed", 308 UpdatedAt: "some-updated-at-time", 309 CreatedAt: "some-created-at-time", 310 }, 311 }, 312 { 313 AppName: "app-4", 314 ServiceBindingName: "binding-name-4", 315 LastOperation: v2action.LastOperation{ 316 Type: "create", 317 State: constant.LastOperationSucceeded, 318 Description: "Binding created", 319 UpdatedAt: "some-updated-at-time", 320 CreatedAt: "some-created-at-time", 321 }, 322 }, 323 } 324 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 325 returnedSummary, 326 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 327 nil) 328 329 }) 330 331 It("displays the service instance summary, all warnings and bound applications in the correct position", func() { 332 Expect(executeErr).ToNot(HaveOccurred()) 333 334 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 335 Expect(testUI.Out).To(Say("\n\n")) 336 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 337 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 338 Expect(testUI.Out).To(Say(`service:\s+some-service`)) 339 Expect(testUI.Out).To(Say(`tags:\s+tag-1, tag-2, tag-3`)) 340 Expect(testUI.Out).To(Say(`plan:\s+some-plan`)) 341 Expect(testUI.Out).To(Say(`description:\s+some-description`)) 342 Expect(testUI.Out).To(Say(`documentation:\s+some-docs-url`)) 343 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 344 Expect(testUI.Out).To(Say(`service broker:\s+broker-1`)) 345 Expect(testUI.Out).To(Say("\n\n")) 346 Expect(testUI.Out).ToNot(Say("shared with spaces:")) 347 Expect(testUI.Out).ToNot(Say(`org\s+space\s+bindings`)) 348 Expect(testUI.Out).ToNot(Say("This service is not currently shared.")) 349 350 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 351 Expect(testUI.Out).To(Say("\n\n")) 352 Expect(testUI.Out).To(Say(`status:\s+some-type some-state`)) 353 Expect(testUI.Out).To(Say(`message:\s+some-last-operation-description`)) 354 Expect(testUI.Out).To(Say(`started:\s+some-created-at-time`)) 355 Expect(testUI.Out).To(Say(`updated:\s+some-updated-at-time`)) 356 Expect(testUI.Out).To(Say("\n\n")) 357 358 Expect(testUI.Out).To(Say("bound apps:")) 359 Expect(testUI.Out).To(Say(`name\s+binding name\s+status\s+message`)) 360 Expect(testUI.Out).To(Say(`app-1\s+binding-name-1\s+`)) 361 Expect(testUI.Out).To(Say(`app-2\s+binding-name-2\s+delete in progress\s+10\% complete`)) 362 Expect(testUI.Out).To(Say(`app-3\s+binding-name-3\s+create failed\s+Binding failed`)) 363 Expect(testUI.Out).To(Say(`app-4\s+binding-name-4\s+create succeeded\s+Binding created`)) 364 365 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 366 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 367 368 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 369 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 370 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 371 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 372 373 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 374 }) 375 }) 376 377 When("the service instance is not shared and is shareable", func() { 378 BeforeEach(func() { 379 returnedSummary.ServiceInstanceShareType = v2action.ServiceInstanceIsNotShared 380 returnedSummary.ServiceInstanceSharingFeatureFlag = true 381 returnedSummary.Service.Extra.Shareable = true 382 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 383 returnedSummary, 384 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 385 nil) 386 }) 387 388 It("displays the service instance summary and all warnings", func() { 389 Expect(executeErr).ToNot(HaveOccurred()) 390 391 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 392 Expect(testUI.Out).To(Say("\n\n")) 393 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 394 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 395 Expect(testUI.Out).To(Say(`service:\s+some-service`)) 396 Expect(testUI.Out).To(Say(`tags:\s+tag-1, tag-2, tag-3`)) 397 Expect(testUI.Out).To(Say(`plan:\s+some-plan`)) 398 Expect(testUI.Out).To(Say(`description:\s+some-description`)) 399 Expect(testUI.Out).To(Say(`documentation:\s+some-docs-url`)) 400 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 401 Expect(testUI.Out).To(Say("\n\n")) 402 Expect(testUI.Out).ToNot(Say("shared with spaces:")) 403 Expect(testUI.Out).ToNot(Say(`org\s+space\s+bindings`)) 404 Expect(testUI.Out).To(Say("This service is not currently shared.")) 405 Expect(testUI.Out).To(Say("\n\n")) 406 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 407 Expect(testUI.Out).To(Say("\n\n")) 408 Expect(testUI.Out).To(Say(`status:\s+some-type some-state`)) 409 Expect(testUI.Out).To(Say(`message:\s+some-last-operation-description`)) 410 Expect(testUI.Out).To(Say(`started:\s+some-created-at-time`)) 411 Expect(testUI.Out).To(Say(`updated:\s+some-updated-at-time`)) 412 413 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 414 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 415 416 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 417 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 418 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 419 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 420 421 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 422 }) 423 }) 424 425 When("the service instance is shared from another space", func() { 426 BeforeEach(func() { 427 returnedSummary.ServiceInstanceShareType = v2action.ServiceInstanceIsSharedFrom 428 returnedSummary.ServiceInstanceSharedFrom = v2action.ServiceInstanceSharedFrom{ 429 SpaceGUID: "some-space-guid", 430 SpaceName: "some-space-name", 431 OrganizationName: "some-org-name", 432 } 433 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 434 returnedSummary, 435 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 436 nil) 437 }) 438 439 It("displays the shared from info and does not display the shared to info", func() { 440 Expect(executeErr).ToNot(HaveOccurred()) 441 442 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 443 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 444 Expect(testUI.Out).To(Say(`shared from org/space:\s+some-org-name / some-space-name`)) 445 Expect(testUI.Out).To(Say(`service:\s+some-service`)) 446 Expect(testUI.Out).ToNot(Say("shared with spaces:")) 447 448 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 449 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 450 }) 451 }) 452 453 When("the service instance is shared to other spaces", func() { 454 BeforeEach(func() { 455 returnedSummary.ServiceInstanceShareType = v2action.ServiceInstanceIsSharedTo 456 returnedSummary.ServiceInstanceSharedTos = []v2action.ServiceInstanceSharedTo{ 457 { 458 SpaceGUID: "another-space-guid", 459 SpaceName: "another-space-name", 460 OrganizationName: "another-org-name", 461 BoundAppCount: 2, 462 }, 463 { 464 SpaceGUID: "yet-another-space-guid", 465 SpaceName: "yet-another-space-name", 466 OrganizationName: "yet-another-org-name", 467 BoundAppCount: 3, 468 }, 469 } 470 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 471 returnedSummary, 472 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 473 nil) 474 }) 475 476 When("the service instance is still shareable", func() { 477 It("displays the shared to info and does not display the shared from info", func() { 478 Expect(executeErr).ToNot(HaveOccurred()) 479 480 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 481 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 482 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 483 Expect(testUI.Out).To(Say("shared with spaces:")) 484 Expect(testUI.Out).To(Say(`org\s+space\s+bindings`)) 485 Expect(testUI.Out).To(Say(`another-org-name\s+another-space-name\s+2`)) 486 Expect(testUI.Out).To(Say(`yet-another-org-name\s+yet-another-space-name\s+3`)) 487 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 488 489 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 490 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 491 }) 492 }) 493 494 When("the service instance is no longer shareable due to global settings only", func() { 495 BeforeEach(func() { 496 returnedSummary.ServiceInstanceSharingFeatureFlag = false 497 returnedSummary.Service.Extra.Shareable = true 498 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 499 returnedSummary, 500 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 501 nil) 502 }) 503 504 It("displays the shared to info and message that the service instance feature flag is disabled", func() { 505 Expect(executeErr).ToNot(HaveOccurred()) 506 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 507 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 508 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 509 Expect(testUI.Out).To(Say("\n\n")) 510 Expect(testUI.Out).To(Say(`The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform.`)) 511 Expect(testUI.Out).To(Say("\n\n")) 512 Expect(testUI.Out).To(Say("shared with spaces:")) 513 Expect(testUI.Out).To(Say(`org\s+space\s+bindings`)) 514 Expect(testUI.Out).To(Say(`another-org-name\s+another-space-name\s+2`)) 515 Expect(testUI.Out).To(Say(`yet-another-org-name\s+yet-another-space-name\s+3`)) 516 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 517 518 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 519 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 520 }) 521 }) 522 523 When("the service instance is no longer shareable due to service broker settings only", func() { 524 BeforeEach(func() { 525 returnedSummary.ServiceInstanceSharingFeatureFlag = true 526 returnedSummary.Service.Extra.Shareable = false 527 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 528 returnedSummary, 529 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 530 nil) 531 }) 532 533 It("displays the shared to info and message that service instance sharing is disabled for the service", func() { 534 Expect(executeErr).ToNot(HaveOccurred()) 535 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 536 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 537 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 538 Expect(testUI.Out).To(Say("\n\n")) 539 Expect(testUI.Out).To(Say("Service instance sharing is disabled for this service.")) 540 Expect(testUI.Out).To(Say("\n\n")) 541 Expect(testUI.Out).To(Say("shared with spaces:")) 542 Expect(testUI.Out).To(Say(`org\s+space\s+bindings`)) 543 Expect(testUI.Out).To(Say(`another-org-name\s+another-space-name\s+2`)) 544 Expect(testUI.Out).To(Say(`yet-another-org-name\s+yet-another-space-name\s+3`)) 545 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 546 547 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 548 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 549 }) 550 }) 551 When("the service instance is no longer shareable due to global settings AND service broker settings", func() { 552 BeforeEach(func() { 553 returnedSummary.ServiceInstanceSharingFeatureFlag = false 554 returnedSummary.Service.Extra.Shareable = false 555 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 556 returnedSummary, 557 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 558 nil) 559 }) 560 561 It("displays the shared to info, the message that the service instance feature flag is disabled and that service instance sharing is disabled for the service", func() { 562 Expect(executeErr).ToNot(HaveOccurred()) 563 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 564 Expect(testUI.Out).ToNot(Say("shared from org/space:")) 565 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 566 Expect(testUI.Out).To(Say("\n\n")) 567 Expect(testUI.Out).To(Say(`The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform. Also, service instance sharing is disabled for this service.`)) 568 Expect(testUI.Out).To(Say("\n\n")) 569 Expect(testUI.Out).To(Say("shared with spaces:")) 570 Expect(testUI.Out).To(Say(`org\s+space\s+bindings`)) 571 Expect(testUI.Out).To(Say(`another-org-name\s+another-space-name\s+2`)) 572 Expect(testUI.Out).To(Say(`yet-another-org-name\s+yet-another-space-name\s+3`)) 573 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 574 575 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 576 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 577 }) 578 }) 579 }) 580 581 When("the service instance has bound apps", func() { 582 When("the service bindings have binding names", func() { 583 BeforeEach(func() { 584 returnedSummary.BoundApplications = []v2action.BoundApplication{ 585 { 586 AppName: "app-1", 587 ServiceBindingName: "binding-name-1", 588 }, 589 { 590 AppName: "app-2", 591 ServiceBindingName: "binding-name-2", 592 }, 593 { 594 AppName: "app-3", 595 ServiceBindingName: "binding-name-3", 596 }, 597 } 598 599 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 600 returnedSummary, 601 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 602 nil) 603 }) 604 605 It("displays the bound apps table with service binding names", func() { 606 Expect(executeErr).ToNot(HaveOccurred()) 607 608 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 609 Expect(testUI.Out).To(Say("\n\n")) 610 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 611 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 612 Expect(testUI.Out).To(Say("\n\n")) 613 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 614 Expect(testUI.Out).To(Say("\n\n")) 615 Expect(testUI.Out).To(Say("bound apps:")) 616 Expect(testUI.Out).To(Say(`name\s+binding name\s+status\s+message`)) 617 Expect(testUI.Out).To(Say(`app-1\s+binding-name-1`)) 618 Expect(testUI.Out).To(Say(`app-2\s+binding-name-2`)) 619 Expect(testUI.Out).To(Say(`app-3\s+binding-name-3`)) 620 621 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 622 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 623 624 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 625 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 626 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 627 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 628 629 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 630 }) 631 }) 632 633 When("the service bindings do not have binding names", func() { 634 BeforeEach(func() { 635 returnedSummary.BoundApplications = []v2action.BoundApplication{ 636 {AppName: "app-1"}, 637 {AppName: "app-2"}, 638 {AppName: "app-3"}, 639 } 640 641 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 642 returnedSummary, 643 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 644 nil) 645 }) 646 647 It("displays the bound apps table with NO service binding names", func() { 648 Expect(executeErr).ToNot(HaveOccurred()) 649 650 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 651 Expect(testUI.Out).To(Say("\n\n")) 652 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 653 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 654 Expect(testUI.Out).To(Say("\n\n")) 655 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 656 Expect(testUI.Out).To(Say("\n\n")) 657 Expect(testUI.Out).To(Say("bound apps:")) 658 Expect(testUI.Out).To(Say(`name\s+binding name\s+status\s+message`)) 659 Expect(testUI.Out).To(Say("app-1")) 660 Expect(testUI.Out).To(Say("app-2")) 661 Expect(testUI.Out).To(Say("app-3")) 662 663 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 664 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 665 666 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 667 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 668 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 669 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 670 671 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 672 }) 673 }) 674 }) 675 676 When("the service instance does not have bound apps", func() { 677 It("displays a message indicating that there are no bound apps", func() { 678 Expect(executeErr).ToNot(HaveOccurred()) 679 680 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 681 Expect(testUI.Out).To(Say("\n\n")) 682 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 683 Expect(testUI.Out).To(Say(`dashboard:\s+some-dashboard`)) 684 Expect(testUI.Out).To(Say("\n\n")) 685 Expect(testUI.Out).To(Say(`Showing status of last operation from service some-service-instance\.\.\.`)) 686 Expect(testUI.Out).To(Say("\n\n")) 687 Expect(testUI.Out).To(Say("There are no bound apps for this service.")) 688 689 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 690 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 691 692 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 693 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 694 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 695 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 696 697 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 698 }) 699 700 }) 701 702 When("the service instance does not support an upgrade", func() { 703 It("displays a message indicating that there are no upgrade available", func() { 704 Expect(executeErr).ToNot(HaveOccurred()) 705 706 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 707 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 708 Expect(testUI.Out).To(Say("There are no bound apps for this service.")) 709 710 Expect(testUI.Out).To(Say("\n\n"), "Expect an empty line between 'bound apps' and 'upgrade available' messages") 711 Expect(testUI.Out).To(Say("Upgrades are not supported by this broker.")) 712 713 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 714 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 715 }) 716 }) 717 718 When("the service instance does not have an upgrade available", func() { 719 BeforeEach(func() { 720 maintenanceInfo := ccv2.MaintenanceInfo{ 721 Version: "2.0.0", 722 Description: "This is the maintenance description", 723 } 724 725 returnedSummary.ServicePlan.MaintenanceInfo = maintenanceInfo 726 returnedSummary.ServiceInstance.MaintenanceInfo = maintenanceInfo 727 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 728 returnedSummary, 729 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 730 nil, 731 ) 732 }) 733 734 It("displays a message indicating that there are no upgrade available", func() { 735 Expect(executeErr).ToNot(HaveOccurred()) 736 737 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 738 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 739 Expect(testUI.Out).To(Say("There are no bound apps for this service.")) 740 741 Expect(testUI.Out).To(Say("\n\n"), "Expect an empty line between 'bound apps' and 'upgrade available' messages") 742 Expect(testUI.Out).To(Say("There is no upgrade available for this service.")) 743 744 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 745 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 746 }) 747 }) 748 749 When("the service instance has an upgrade available", func() { 750 BeforeEach(func() { 751 returnedSummary.ServicePlan.MaintenanceInfo = ccv2.MaintenanceInfo{ 752 Version: "2.0.0", 753 Description: "This is the maintenance description", 754 } 755 756 returnedSummary.ServiceInstance.MaintenanceInfo = ccv2.MaintenanceInfo{ 757 Version: "1.0.0", 758 Description: "This is old maintenance description", 759 } 760 761 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 762 returnedSummary, 763 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 764 nil, 765 ) 766 }) 767 768 It("displays a message with the upgrade available description", func() { 769 Expect(executeErr).ToNot(HaveOccurred()) 770 771 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 772 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 773 Expect(testUI.Out).To(Say("There are no bound apps for this service.")) 774 775 Expect(testUI.Out).To(Say("\n\n"), "Expect an empty line between 'bound apps' and 'upgrade available' messages") 776 Expect(testUI.Out).To(Say("Showing available upgrade details for this service...")) 777 Expect(testUI.Out).To(Say("\n\n"), "Expect an empty line between messages") 778 Expect(testUI.Out).To(Say("upgrade description: This is the maintenance description")) 779 Expect(testUI.Out).To(Say("\n\n"), "Expect an empty line before tips") 780 Expect(testUI.Out).To(Say("TIP: You can upgrade using 'cf update-service some-service-instance --upgrade'")) 781 782 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 783 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 784 }) 785 }) 786 787 When("the version of CC API is less than minimum version supporting maintenance_info", func() { 788 BeforeEach(func() { 789 fakeActor.CloudControllerAPIVersionReturns(ccversion.MinVersionUpdateServiceInstanceMaintenanceInfoV2) 790 }) 791 792 It("should not output anything about upgrades", func() { 793 Consistently(testUI.Out).ShouldNot(Say("There is no upgrade available for this service.")) 794 Consistently(testUI.Out).ShouldNot(Say("Upgrades are not supported by this broker.")) 795 Consistently(testUI.Out).ShouldNot(Say("Showing available upgrade details for this service...")) 796 Consistently(testUI.Out).ShouldNot(Say("upgrade description: This is the maintenance description")) 797 Consistently(testUI.Out).ShouldNot(Say("TIP: You can upgrade using 'cf update-service some-service-instance --upgrade'")) 798 }) 799 }) 800 801 When("the version of CC API is broken", func() { 802 BeforeEach(func() { 803 fakeActor.CloudControllerAPIVersionReturns("broken") 804 }) 805 806 It("should fail", func() { 807 Expect(executeErr).To(HaveOccurred()) 808 }) 809 }) 810 }) 811 812 When("the service instance is a user provided service instance", func() { 813 BeforeEach(func() { 814 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 815 v2action.ServiceInstanceSummary{ 816 ServiceInstance: v2action.ServiceInstance{ 817 Name: "some-service-instance", 818 Type: constant.UserProvidedService, 819 }, 820 }, 821 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 822 nil, 823 ) 824 }) 825 826 It("displays a smaller service instance summary than for managed service instances", func() { 827 Expect(executeErr).ToNot(HaveOccurred()) 828 829 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 830 Expect(testUI.Out).To(Say("")) 831 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 832 Expect(testUI.Out).ToNot(Say("shared from")) 833 Expect(testUI.Out).To(Say(`service:\s+user-provided`)) 834 Expect(testUI.Out).To(Say("tags:")) 835 Expect(testUI.Out).ToNot(Say("plan:")) 836 Expect(testUI.Out).ToNot(Say("description:")) 837 Expect(testUI.Out).ToNot(Say("documentation:")) 838 Expect(testUI.Out).ToNot(Say("dashboard:")) 839 Expect(testUI.Out).ToNot(Say("shared with spaces")) 840 Expect(testUI.Out).ToNot(Say("last operation")) 841 Expect(testUI.Out).ToNot(Say("status:")) 842 Expect(testUI.Out).ToNot(Say("message:")) 843 Expect(testUI.Out).ToNot(Say("started:")) 844 Expect(testUI.Out).ToNot(Say("updated:")) 845 846 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 847 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 848 849 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 850 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 851 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 852 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 853 854 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 855 }) 856 857 When("the service instance has bound apps", func() { 858 When("the service bindings have binding names", func() { 859 BeforeEach(func() { 860 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 861 v2action.ServiceInstanceSummary{ 862 ServiceInstance: v2action.ServiceInstance{ 863 Name: "some-service-instance", 864 Type: constant.UserProvidedService, 865 }, 866 BoundApplications: []v2action.BoundApplication{ 867 { 868 AppName: "app-1", 869 ServiceBindingName: "binding-name-1", 870 }, 871 { 872 AppName: "app-2", 873 ServiceBindingName: "binding-name-2", 874 }, 875 { 876 AppName: "app-3", 877 ServiceBindingName: "binding-name-3", 878 }, 879 }, 880 }, 881 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 882 nil, 883 ) 884 }) 885 886 It("displays the bound apps table with service binding names", func() { 887 Expect(executeErr).ToNot(HaveOccurred()) 888 889 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 890 Expect(testUI.Out).To(Say("\n\n")) 891 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 892 Expect(testUI.Out).To(Say(`service:\s+user-provided`)) 893 Expect(testUI.Out).To(Say("\n\n")) 894 Expect(testUI.Out).To(Say("bound apps:")) 895 Expect(testUI.Out).To(Say(`name\s+binding name\s+status\s+message`)) 896 Expect(testUI.Out).To(Say(`app-1\s+binding-name-1`)) 897 Expect(testUI.Out).To(Say(`app-2\s+binding-name-2`)) 898 Expect(testUI.Out).To(Say(`app-3\s+binding-name-3`)) 899 900 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 901 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 902 903 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 904 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 905 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 906 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 907 908 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 909 }) 910 }) 911 912 When("the service bindings do not have binding names", func() { 913 BeforeEach(func() { 914 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 915 v2action.ServiceInstanceSummary{ 916 ServiceInstance: v2action.ServiceInstance{ 917 Name: "some-service-instance", 918 Type: constant.UserProvidedService, 919 }, 920 BoundApplications: []v2action.BoundApplication{ 921 {AppName: "app-1"}, 922 {AppName: "app-2"}, 923 {AppName: "app-3"}, 924 }, 925 }, 926 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 927 nil, 928 ) 929 }) 930 931 It("displays the bound apps table with NO service binding names", func() { 932 Expect(executeErr).ToNot(HaveOccurred()) 933 934 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 935 Expect(testUI.Out).To(Say("\n\n")) 936 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 937 Expect(testUI.Out).To(Say(`service:\s+user-provided`)) 938 Expect(testUI.Out).To(Say("\n\n")) 939 Expect(testUI.Out).To(Say("bound apps:")) 940 Expect(testUI.Out).To(Say(`name\s+binding name\s+status\s+message`)) 941 Expect(testUI.Out).To(Say("app-1")) 942 Expect(testUI.Out).To(Say("app-2")) 943 Expect(testUI.Out).To(Say("app-3")) 944 945 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-1")) 946 Expect(testUI.Err).To(Say("get-service-instance-summary-warning-2")) 947 948 Expect(fakeActor.GetServiceInstanceSummaryByNameAndSpaceCallCount()).To(Equal(1)) 949 serviceInstanceNameArg, spaceGUIDArg := fakeActor.GetServiceInstanceSummaryByNameAndSpaceArgsForCall(0) 950 Expect(serviceInstanceNameArg).To(Equal("some-service-instance")) 951 Expect(spaceGUIDArg).To(Equal("some-space-guid")) 952 953 Expect(fakeActor.GetServiceInstanceByNameAndSpaceCallCount()).To(Equal(0)) 954 }) 955 956 }) 957 }) 958 959 When("the service instance does not have bound apps", func() { 960 It("displays a message indicating that there are no bound apps", func() { 961 Expect(executeErr).ToNot(HaveOccurred()) 962 963 Expect(testUI.Out).To(Say(`Showing info of service some-service-instance in org some-org / space some-space as some-user\.\.\.`)) 964 Expect(testUI.Out).To(Say("\n\n")) 965 Expect(testUI.Out).To(Say(`name:\s+some-service-instance`)) 966 Expect(testUI.Out).To(Say(`service:\s+user-provided`)) 967 Expect(testUI.Out).To(Say("\n\n")) 968 Expect(testUI.Out).To(Say("There are no bound apps for this service.")) 969 }) 970 }) 971 972 When("the service instance have tags", func() { 973 BeforeEach(func() { 974 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 975 v2action.ServiceInstanceSummary{ 976 ServiceInstance: v2action.ServiceInstance{ 977 Name: "some-service-instance", 978 Type: constant.UserProvidedService, 979 Tags: []string{"tag-1", "tag-2", "tag-3"}, 980 }, 981 }, 982 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 983 nil, 984 ) 985 }) 986 987 It("displays the tags", func() { 988 Expect(executeErr).ToNot(HaveOccurred()) 989 990 Expect(testUI.Out).To(Say(`tags:\s+tag-1, tag-2, tag-3`)) 991 }) 992 }) 993 994 When("the service instance has route service url", func() { 995 BeforeEach(func() { 996 fakeActor.GetServiceInstanceSummaryByNameAndSpaceReturns( 997 v2action.ServiceInstanceSummary{ 998 ServiceInstance: v2action.ServiceInstance{ 999 Name: "some-service-instance", 1000 Type: constant.UserProvidedService, 1001 RouteServiceURL: "some-route-service-url", 1002 }, 1003 }, 1004 v2action.Warnings{"get-service-instance-summary-warning-1", "get-service-instance-summary-warning-2"}, 1005 nil, 1006 ) 1007 }) 1008 1009 It("displays the route service url", func() { 1010 Expect(executeErr).ToNot(HaveOccurred()) 1011 1012 Expect(testUI.Out).To(Say(`route service url:\s+some-route-service-url`)) 1013 }) 1014 }) 1015 }) 1016 }) 1017 }) 1018 }) 1019 }) 1020 })