github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/isolated/service_command_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 5 "code.cloudfoundry.org/cli/integration/assets/hydrabroker/config" 6 "code.cloudfoundry.org/cli/integration/helpers" 7 "code.cloudfoundry.org/cli/integration/helpers/servicebrokerstub" 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 . "github.com/onsi/gomega/gbytes" 11 . "github.com/onsi/gomega/gexec" 12 ) 13 14 var _ = Describe("service command", func() { 15 var serviceInstanceName string 16 17 BeforeEach(func() { 18 serviceInstanceName = helpers.PrefixedRandomName("SI") 19 }) 20 21 Describe("help", func() { 22 When("--help flag is set", func() { 23 It("displays command usage to output", func() { 24 session := helpers.CF("service", "--help") 25 Eventually(session).Should(Say("NAME:")) 26 Eventually(session).Should(Say(`\s+service - Show service instance info`)) 27 Eventually(session).Should(Say("USAGE:")) 28 Eventually(session).Should(Say(`\s+cf service SERVICE_INSTANCE`)) 29 Eventually(session).Should(Say("OPTIONS:")) 30 Eventually(session).Should(Say(`\s+\-\-guid\s+Retrieve and display the given service's guid\. All other output for the service is suppressed\.`)) 31 Eventually(session).Should(Say("SEE ALSO:")) 32 Eventually(session).Should(Say(`\s+bind-service, rename-service, update-service`)) 33 Eventually(session).Should(Exit(0)) 34 }) 35 }) 36 }) 37 38 When("the environment is not setup correctly", func() { 39 It("fails with the appropriate errors", func() { 40 helpers.CheckEnvironmentTargetedCorrectly(true, true, ReadOnlyOrg, "service", "some-service") 41 }) 42 }) 43 44 When("an api is targeted, the user is logged in, and an org and space are targeted", func() { 45 var ( 46 orgName string 47 spaceName string 48 userName string 49 ) 50 51 BeforeEach(func() { 52 orgName = helpers.NewOrgName() 53 spaceName = helpers.NewSpaceName() 54 helpers.SetupCF(orgName, spaceName) 55 56 userName, _ = helpers.GetCredentials() 57 }) 58 59 AfterEach(func() { 60 helpers.QuickDeleteOrg(orgName) 61 }) 62 63 When("the service instance does not exist", func() { 64 It("returns an error and exits 1", func() { 65 session := helpers.CF("service", serviceInstanceName) 66 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 67 Eventually(session).Should(Say("")) 68 Eventually(session).Should(Say("FAILED")) 69 Eventually(session.Err).Should(Say("Service instance %s not found", serviceInstanceName)) 70 Eventually(session).Should(Exit(1)) 71 }) 72 }) 73 74 When("the service instance belongs to this space", func() { 75 When("the service instance is a user provided service instance", func() { 76 BeforeEach(func() { 77 Eventually(helpers.CF("create-user-provided-service", serviceInstanceName)).Should(Exit(0)) 78 }) 79 80 AfterEach(func() { 81 Eventually(helpers.CF("delete-service", serviceInstanceName, "-f")).Should(Exit(0)) 82 }) 83 84 When("the --guid flag is provided", func() { 85 It("displays the service instance GUID", func() { 86 session := helpers.CF("service", serviceInstanceName, "--guid") 87 Consistently(session).ShouldNot(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 88 Eventually(session).Should(Say(helpers.UserProvidedServiceInstanceGUID(serviceInstanceName))) 89 Eventually(session).Should(Exit(0)) 90 }) 91 }) 92 93 When("no apps are bound to the service instance", func() { 94 It("displays service instance info", func() { 95 session := helpers.CF("service", serviceInstanceName) 96 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 97 Eventually(session).Should(Say("")) 98 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 99 Eventually(session).Should(Say(`service:\s+user-provided`)) 100 Eventually(session).Should(Say("")) 101 Eventually(session).Should(Say("There are no bound apps for this service.")) 102 Eventually(session).Should(Say("")) 103 Eventually(session).Should(Exit(0)) 104 }) 105 }) 106 107 When("apps are bound to the service instance", func() { 108 var ( 109 appName1 string 110 appName2 string 111 ) 112 113 BeforeEach(func() { 114 appName1 = helpers.PrefixedRandomName("1-INTEGRATION-APP") 115 appName2 = helpers.PrefixedRandomName("2-INTEGRATION-APP") 116 117 helpers.WithHelloWorldApp(func(appDir string) { 118 Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 119 Eventually(helpers.CF("push", appName2, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 120 }) 121 }) 122 123 AfterEach(func() { 124 Eventually(helpers.CF("delete", appName1, "-f")).Should(Exit(0)) 125 Eventually(helpers.CF("delete", appName2, "-f")).Should(Exit(0)) 126 }) 127 128 When("the service bindings do not have binding names", func() { 129 BeforeEach(func() { 130 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName)).Should(Exit(0)) 131 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName)).Should(Exit(0)) 132 }) 133 134 AfterEach(func() { 135 Eventually(helpers.CF("unbind-service", appName1, serviceInstanceName)).Should(Exit(0)) 136 Eventually(helpers.CF("unbind-service", appName2, serviceInstanceName)).Should(Exit(0)) 137 }) 138 139 It("displays service instance info", func() { 140 session := helpers.CF("service", serviceInstanceName) 141 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 142 Eventually(session).Should(Say("")) 143 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 144 Eventually(session).Should(Say(`service:\s+user-provided`)) 145 Eventually(session).Should(Say("")) 146 Eventually(session).Should(Say("bound apps:")) 147 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 148 Eventually(session).Should(Say(appName1)) 149 Eventually(session).Should(Say(appName2)) 150 151 Eventually(session).Should(Exit(0)) 152 }) 153 }) 154 155 When("the service bindings have binding names", func() { 156 var ( 157 bindingName1 string 158 bindingName2 string 159 ) 160 161 BeforeEach(func() { 162 bindingName1 = helpers.PrefixedRandomName("BINDING-NAME") 163 bindingName2 = helpers.PrefixedRandomName("BINDING-NAME") 164 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName, "--binding-name", bindingName1)).Should(Exit(0)) 165 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName, "--binding-name", bindingName2)).Should(Exit(0)) 166 }) 167 168 AfterEach(func() { 169 Eventually(helpers.CF("unbind-service", appName1, serviceInstanceName)).Should(Exit(0)) 170 Eventually(helpers.CF("unbind-service", appName2, serviceInstanceName)).Should(Exit(0)) 171 }) 172 173 It("displays service instance info", func() { 174 session := helpers.CF("service", serviceInstanceName) 175 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 176 Eventually(session).Should(Say("")) 177 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 178 Eventually(session).Should(Say(`service:\s+user-provided`)) 179 Eventually(session).Should(Say("")) 180 Eventually(session).Should(Say("bound apps:")) 181 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 182 Eventually(session).Should(Say(`%s\s+%s`, appName1, bindingName1)) 183 Eventually(session).Should(Say(`%s\s+%s`, appName2, bindingName2)) 184 Eventually(session).Should(Say("")) 185 Eventually(session).Should(Exit(0)) 186 }) 187 }) 188 }) 189 190 When("we update the user provided service instance with tags", func() { 191 BeforeEach(func() { 192 Eventually(helpers.CF("update-user-provided-service", serviceInstanceName, 193 "-t", "foo, bar")).Should(Exit(0)) 194 }) 195 196 It("displays service instance info", func() { 197 session := helpers.CF("service", serviceInstanceName) 198 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 199 Eventually(session).Should(Say(`tags:\s+foo, bar`)) 200 Eventually(session).Should(Exit(0)) 201 }) 202 }) 203 }) 204 205 When("a user-provided service instance is created with tags", func() { 206 BeforeEach(func() { 207 Eventually(helpers.CF("create-user-provided-service", serviceInstanceName, "-t", "database, email")).Should(Exit(0)) 208 }) 209 210 It("displays tag info", func() { 211 session := helpers.CF("service", serviceInstanceName) 212 Eventually(session).Should(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 213 Eventually(session).Should(Say(`tags:\s+database, email`)) 214 Eventually(session).Should(Exit(0)) 215 }) 216 }) 217 218 When("the service instance is a managed service instance", func() { 219 var ( 220 service string 221 servicePlan string 222 broker *servicebrokerstub.ServiceBrokerStub 223 ) 224 225 BeforeEach(func() { 226 broker = servicebrokerstub.EnableServiceAccess() 227 service = broker.FirstServiceOfferingName() 228 servicePlan = broker.FirstServicePlanName() 229 230 Eventually(helpers.CF("create-service", service, servicePlan, serviceInstanceName, "-t", "database, email")).Should(Exit(0)) 231 }) 232 233 AfterEach(func() { 234 Eventually(helpers.CF("delete-service", serviceInstanceName, "-f")).Should(Exit(0)) 235 broker.Forget() 236 }) 237 238 When("the --guid flag is provided", func() { 239 It("displays the service instance GUID", func() { 240 session := helpers.CF("service", serviceInstanceName, "--guid") 241 Consistently(session).ShouldNot(Say("Showing info of service %s in org %s / space %s as %s", serviceInstanceName, orgName, spaceName, userName)) 242 Eventually(session).Should(Say(helpers.ManagedServiceInstanceGUID(serviceInstanceName))) 243 Eventually(session).Should(Exit(0)) 244 }) 245 }) 246 247 When("apps are bound to the service instance", func() { 248 var ( 249 appName1 string 250 appName2 string 251 ) 252 253 BeforeEach(func() { 254 appName1 = helpers.PrefixedRandomName("1-INTEGRATION-APP") 255 appName2 = helpers.PrefixedRandomName("2-INTEGRATION-APP") 256 257 helpers.WithHelloWorldApp(func(appDir string) { 258 Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 259 Eventually(helpers.CF("push", appName2, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 260 }) 261 }) 262 263 AfterEach(func() { 264 Eventually(helpers.CF("delete", appName1, "-f")).Should(Exit(0)) 265 Eventually(helpers.CF("delete", appName2, "-f")).Should(Exit(0)) 266 }) 267 268 When("the service bindings do not have binding names", func() { 269 BeforeEach(func() { 270 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName)).Should(Exit(0)) 271 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName)).Should(Exit(0)) 272 }) 273 274 AfterEach(func() { 275 Eventually(helpers.CF("unbind-service", appName1, serviceInstanceName)).Should(Exit(0)) 276 Eventually(helpers.CF("unbind-service", appName2, serviceInstanceName)).Should(Exit(0)) 277 }) 278 279 It("displays service instance info", func() { 280 session := helpers.CF("service", serviceInstanceName) 281 Eventually(session).Should(Say(`Showing info of service %s in org %s / space %s as %s\.\.\.`, serviceInstanceName, orgName, spaceName, userName)) 282 Eventually(session).Should(Say("\n\n")) 283 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 284 Consistently(session).ShouldNot(Say("shared from:")) 285 Eventually(session).Should(Say(`service:\s+%s`, service)) 286 Eventually(session).Should(Say(`tags:\s+database, email`)) 287 Eventually(session).Should(Say(`plan:\s+%s`, servicePlan)) 288 Eventually(session).Should(Say(`description:\s+%s`, broker.FirstServiceOfferingDescription())) 289 Eventually(session).Should(Say(`documentation:\s+http://documentation\.url`)) 290 Eventually(session).Should(Say(`dashboard:\s+http://example\.com`)) 291 Eventually(session).Should(Say(`service broker:\s+%s`, broker.Name)) 292 Eventually(session).Should(Say("\n\n")) 293 Consistently(session).ShouldNot(Say("shared with spaces:")) 294 Eventually(session).Should(Say(`Showing status of last operation from service %s\.\.\.`, serviceInstanceName)) 295 Eventually(session).Should(Say("\n\n")) 296 Eventually(session).Should(Say(`status:\s+create succeeded`)) 297 Eventually(session).Should(Say("message:")) 298 Eventually(session).Should(Say(`started:\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`)) 299 Eventually(session).Should(Say(`updated:\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`)) 300 Eventually(session).Should(Say("\n\n")) 301 Eventually(session).Should(Say("bound apps:")) 302 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 303 Eventually(session).Should(Say(appName1)) 304 Eventually(session).Should(Say(appName2)) 305 Eventually(session).Should(Exit(0)) 306 }) 307 }) 308 309 When("the service bindings have binding names", func() { 310 var ( 311 bindingName1 string 312 bindingName2 string 313 ) 314 315 BeforeEach(func() { 316 bindingName1 = helpers.PrefixedRandomName("BINDING-NAME") 317 bindingName2 = helpers.PrefixedRandomName("BINDING-NAME") 318 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName, "--binding-name", bindingName1)).Should(Exit(0)) 319 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName, "--binding-name", bindingName2)).Should(Exit(0)) 320 }) 321 322 AfterEach(func() { 323 Eventually(helpers.CF("unbind-service", appName1, serviceInstanceName)).Should(Exit(0)) 324 Eventually(helpers.CF("unbind-service", appName2, serviceInstanceName)).Should(Exit(0)) 325 }) 326 327 It("displays service instance info", func() { 328 session := helpers.CF("service", serviceInstanceName) 329 Eventually(session).Should(Say(`Showing info of service %s in org %s / space %s as %s\.\.\.`, serviceInstanceName, orgName, spaceName, userName)) 330 Eventually(session).Should(Say("\n\n")) 331 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 332 Consistently(session).ShouldNot(Say("shared from:")) 333 Eventually(session).Should(Say(`service:\s+%s`, service)) 334 Eventually(session).Should(Say(`tags:\s+database, email`)) 335 Eventually(session).Should(Say(`plan:\s+%s`, servicePlan)) 336 Eventually(session).Should(Say(`description:\s+%s`, broker.FirstServiceOfferingDescription())) 337 Eventually(session).Should(Say(`documentation:\s+http://documentation\.url`)) 338 Eventually(session).Should(Say(`dashboard:\s+http://example\.com`)) 339 Eventually(session).Should(Say("\n\n")) 340 Consistently(session).ShouldNot(Say("shared with spaces:")) 341 Eventually(session).Should(Say(`Showing status of last operation from service %s\.\.\.`, serviceInstanceName)) 342 Eventually(session).Should(Say("\n\n")) 343 Eventually(session).Should(Say(`status:\s+create succeeded`)) 344 Eventually(session).Should(Say("message:")) 345 Eventually(session).Should(Say(`started:\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`)) 346 Eventually(session).Should(Say(`updated:\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`)) 347 Eventually(session).Should(Say("\n\n")) 348 Eventually(session).Should(Say("bound apps:")) 349 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 350 Eventually(session).Should(Say(`%s\s+%s`, appName1, bindingName1)) 351 Eventually(session).Should(Say(`%s\s+%s`, appName2, bindingName2)) 352 353 Eventually(session).Should(Exit(0)) 354 }) 355 }) 356 357 When("the binding has a state", func() { 358 var ( 359 bindingName1 string 360 bindingName2 string 361 ) 362 363 BeforeEach(func() { 364 bindingName1 = helpers.PrefixedRandomName("BINDING-NAME") 365 bindingName2 = helpers.PrefixedRandomName("BINDING-NAME") 366 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName, "--binding-name", bindingName1)).Should(Exit(0)) 367 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName, "--binding-name", bindingName2)).Should(Exit(0)) 368 }) 369 370 AfterEach(func() { 371 Eventually(helpers.CF("unbind-service", appName1, serviceInstanceName)).Should(Exit(0)) 372 Eventually(helpers.CF("unbind-service", appName2, serviceInstanceName)).Should(Exit(0)) 373 }) 374 375 It("displays it in the status field", func() { 376 session := helpers.CF("service", serviceInstanceName) 377 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 378 Eventually(session).Should(Say("bound apps:")) 379 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 380 Eventually(session).Should(Say(`%s\s+%s\s+create succeeded`, appName1, bindingName1)) 381 Eventually(session).Should(Say(`%s\s+%s\s+create succeeded`, appName2, bindingName2)) 382 383 Eventually(session).Should(Exit(0)) 384 }) 385 }) 386 }) 387 388 When("Upgrade available", func() { 389 BeforeEach(func() { 390 helpers.SkipIfVersionLessThan(ccversion.MinVersionMaintenanceInfoInSummaryV2) 391 }) 392 393 When("maintenance_info is not configured", func() { 394 It("says that the broker does not support upgrades", func() { 395 session := helpers.CF("service", serviceInstanceName) 396 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 397 Eventually(session).Should(Say("Upgrades are not supported by this broker.")) 398 }) 399 }) 400 401 When("maintenance_info is configured", func() { 402 BeforeEach(func() { 403 broker.Services[0].Plans[0].MaintenanceInfo = &config.MaintenanceInfo{ 404 Version: "3.0.0", 405 Description: "Stemcell update.\nExpect downtime.", 406 } 407 broker.Configure().Register() 408 }) 409 410 It("says that an upgrade is available", func() { 411 session := helpers.CF("service", serviceInstanceName) 412 Eventually(session).Should(Say(`name:\s+%s`, serviceInstanceName)) 413 Eventually(session).Should(Say("Showing available upgrade details for this service...")) 414 Eventually(session).Should(Say("upgrade description: Stemcell update.\nExpect downtime.")) 415 Eventually(session).Should(Say(`TIP: You can upgrade using 'cf update-service %s --upgrade'`, serviceInstanceName)) 416 }) 417 418 It("says that a new service instance is already up to date", func() { 419 newServiceInstanceName := helpers.PrefixedRandomName("SI") 420 session := helpers.CF("create-service", service, servicePlan, newServiceInstanceName) 421 Eventually(session).Should(Exit(0)) 422 423 session = helpers.CF("service", newServiceInstanceName) 424 Eventually(session).Should(Say(`name:\s+%s`, newServiceInstanceName)) 425 Eventually(session).Should(Say("There is no upgrade available for this service.")) 426 Eventually(session).Should(Exit(0)) 427 428 session = helpers.CF("delete-service", "-f", newServiceInstanceName) 429 Eventually(session).Should(Exit(0)) 430 }) 431 }) 432 }) 433 }) 434 }) 435 }) 436 437 Context("service instance sharing when there are multiple spaces", func() { 438 var ( 439 orgName string 440 sourceSpaceName string 441 442 service string 443 servicePlan string 444 broker *servicebrokerstub.ServiceBrokerStub 445 ) 446 447 BeforeEach(func() { 448 orgName = helpers.NewOrgName() 449 sourceSpaceName = helpers.NewSpaceName() 450 helpers.SetupCF(orgName, sourceSpaceName) 451 452 broker = servicebrokerstub.EnableServiceAccess() 453 service = broker.FirstServiceOfferingName() 454 servicePlan = broker.FirstServicePlanName() 455 456 Eventually(helpers.CF("create-service", service, servicePlan, serviceInstanceName)).Should(Exit(0)) 457 }) 458 459 AfterEach(func() { 460 broker.Forget() 461 helpers.QuickDeleteOrg(orgName) 462 }) 463 464 Context("service has no type of shares", func() { 465 When("the service is shareable", func() { 466 It("should not display shared from or shared with information, but DOES display not currently shared info", func() { 467 session := helpers.CF("service", serviceInstanceName) 468 Eventually(session).Should(Say("This service is not currently shared.")) 469 Eventually(session).Should(Exit(0)) 470 }) 471 }) 472 }) 473 474 Context("service is shared between two spaces", func() { 475 var ( 476 targetSpaceName string 477 ) 478 479 BeforeEach(func() { 480 targetSpaceName = helpers.NewSpaceName() 481 helpers.CreateOrgAndSpace(orgName, targetSpaceName) 482 helpers.TargetOrgAndSpace(orgName, sourceSpaceName) 483 Eventually(helpers.CF("share-service", serviceInstanceName, "-s", targetSpaceName)).Should(Exit(0)) 484 }) 485 486 When("the user is targeted to the source space", func() { 487 When("there are externally bound apps to the service", func() { 488 BeforeEach(func() { 489 helpers.TargetOrgAndSpace(orgName, targetSpaceName) 490 helpers.WithHelloWorldApp(func(appDir string) { 491 appName1 := helpers.NewAppName() 492 Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 493 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName)).Should(Exit(0)) 494 495 appName2 := helpers.NewAppName() 496 Eventually(helpers.CF("push", appName2, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 497 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName)).Should(Exit(0)) 498 }) 499 helpers.TargetOrgAndSpace(orgName, sourceSpaceName) 500 }) 501 502 It("should display the number of bound apps next to the target space name", func() { 503 session := helpers.CF("service", serviceInstanceName) 504 Eventually(session).Should(Say("shared with spaces:")) 505 Eventually(session).Should(Say(`org\s+space\s+bindings`)) 506 Eventually(session).Should(Say(`%s\s+%s\s+2`, orgName, targetSpaceName)) 507 Eventually(session).Should(Exit(0)) 508 }) 509 }) 510 511 When("there are no externally bound apps to the service", func() { 512 It("should NOT display the number of bound apps next to the target space name", func() { 513 session := helpers.CF("service", serviceInstanceName) 514 Eventually(session).Should(Say("shared with spaces:")) 515 Eventually(session).Should(Say(`org\s+space\s+bindings`)) 516 Eventually(session).Should(Exit(0)) 517 }) 518 }) 519 520 When("the service is no longer shareable", func() { 521 Context("due to service broker settings", func() { 522 BeforeEach(func() { 523 broker.Services[0].Shareable = false 524 broker.Configure().Register() 525 }) 526 527 It("should display that service instance sharing is disabled for this service", func() { 528 session := helpers.CF("service", serviceInstanceName) 529 Eventually(session).Should(Say("Service instance sharing is disabled for this service.")) 530 Eventually(session).Should(Exit(0)) 531 }) 532 }) 533 }) 534 }) 535 536 When("the user is targeted to the target space", func() { 537 var appName1, appName2 string 538 539 BeforeEach(func() { 540 // We test that the app names are listed in alphanumeric sort order 541 appName1 = helpers.PrefixedRandomName("2-INTEGRATION-APP") 542 appName2 = helpers.PrefixedRandomName("1-INTEGRATION-APP") 543 helpers.TargetOrgAndSpace(orgName, targetSpaceName) 544 helpers.WithHelloWorldApp(func(appDir string) { 545 Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 546 Eventually(helpers.CF("bind-service", appName1, serviceInstanceName)).Should(Exit(0)) 547 548 Eventually(helpers.CF("push", appName2, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 549 Eventually(helpers.CF("bind-service", appName2, serviceInstanceName)).Should(Exit(0)) 550 }) 551 }) 552 553 When("there are bound apps to the service with no binding names", func() { 554 It("should display the bound apps in alphanumeric sort order", func() { 555 session := helpers.CF("service", serviceInstanceName) 556 Eventually(session).Should(Say(`shared from org/space:\s+%s / %s`, orgName, sourceSpaceName)) 557 Eventually(session).Should(Say("\n\n")) 558 Eventually(session).Should(Say("bound apps:")) 559 Eventually(session).Should(Say(`name\s+binding name\s+status\s+message`)) 560 Eventually(session).Should(Say(appName2)) 561 Eventually(session).Should(Say(appName1)) 562 Eventually(session).Should(Exit(0)) 563 }) 564 }) 565 }) 566 }) 567 }) 568 })