github.com/willmadison/cli@v6.40.1-0.20181018160101-29d5937903ff+incompatible/integration/shared/global/update_buildpack_command_test.go (about) 1 package global 2 3 import ( 4 "bytes" 5 "io/ioutil" 6 "log" 7 "net/http" 8 "os" 9 "regexp" 10 11 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 12 "code.cloudfoundry.org/cli/integration/helpers" 13 . "github.com/onsi/ginkgo" 14 . "github.com/onsi/gomega" 15 . "github.com/onsi/gomega/gbytes" 16 . "github.com/onsi/gomega/gexec" 17 . "github.com/onsi/gomega/ghttp" 18 ) 19 20 var _ = Describe("update-buildpack command", func() { 21 var ( 22 buildpackName string 23 username string 24 ) 25 26 BeforeEach(func() { 27 buildpackName = helpers.NewBuildpackName() 28 username, _ = helpers.GetCredentials() 29 }) 30 31 When("--help flag is set", func() { 32 It("Displays command usage to output", func() { 33 session := helpers.CF("update-buildpack", "--help") 34 Eventually(session).Should(Say("NAME:")) 35 Eventually(session).Should(Say("update-buildpack - Update a buildpack")) 36 Eventually(session).Should(Say("USAGE:")) 37 Eventually(session).Should(Say("cf update-buildpack BUILDPACK \\[-p PATH\\] \\[-i POSITION\\] \\[-s STACK\\] \\[--enable\\|--disable\\] \\[--lock\\|--unlock\\]")) 38 Eventually(session).Should(Say("TIP:")) 39 Eventually(session).Should(Say("Path should be a zip file, a url to a zip file, or a local directory. Position is a positive integer, sets priority, and is sorted from lowest to highest.")) 40 Eventually(session).Should(Say("OPTIONS:")) 41 Eventually(session).Should(Say("--disable\\s+Disable the buildpack from being used for staging")) 42 Eventually(session).Should(Say("--enable\\s+Enable the buildpack to be used for staging")) 43 Eventually(session).Should(Say("-i\\s+The order in which the buildpacks are checked during buildpack auto-detection")) 44 Eventually(session).Should(Say("--lock\\s+Lock the buildpack to prevent updates")) 45 Eventually(session).Should(Say("-p\\s+Path to directory or zip file")) 46 Eventually(session).Should(Say("--unlock\\s+Unlock the buildpack to enable updates")) 47 Eventually(session).Should(Say("-s\\s+Specify stack to disambiguate buildpacks with the same name")) 48 Eventually(session).Should(Say("SEE ALSO:")) 49 Eventually(session).Should(Say("buildpacks, rename-buildpack")) 50 Eventually(session).Should(Exit(0)) 51 }) 52 }) 53 54 When("the environment is not setup correctly", func() { 55 It("fails with the appropriate errors", func() { 56 helpers.CheckEnvironmentTargetedCorrectly(false, false, ReadOnlyOrg, "update-buildpack", "fake-buildpack") 57 }) 58 }) 59 60 When("the user is logged in", func() { 61 BeforeEach(func() { 62 helpers.LoginCF() 63 }) 64 65 When("the buildpack is not provided", func() { 66 It("returns a buildpack argument not provided error", func() { 67 session := helpers.CF("update-buildpack", "-p", ".") 68 69 Eventually(session.Err).Should(Say("Incorrect Usage: the required argument `BUILDPACK` was not provided")) 70 Eventually(session).Should(Exit(1)) 71 }) 72 }) 73 74 When("the buildpack name is provided", func() { 75 When("the buildpack does not exist", func() { 76 It("returns a buildpack not found error", func() { 77 session := helpers.CF("update-buildpack", buildpackName) 78 Eventually(session.Err).Should(Say("Buildpack %s not found", buildpackName)) 79 Eventually(session).Should(Say("FAILED")) 80 Eventually(session).Should(Exit(1)) 81 }) 82 }) 83 84 Describe("stack association", func() { 85 var stacks []string 86 87 BeforeEach(func() { 88 helpers.SkipIfVersionLessThan(ccversion.MinVersionBuildpackStackAssociationV2) 89 stacks = helpers.EnsureMinimumNumberOfStacks(2) 90 }) 91 92 When("multiple buildpacks with the same name exist in enabled and unlocked state, and one has nil stack", func() { 93 BeforeEach(func() { 94 helpers.BuildpackWithStack(func(buildpackArchive string) { 95 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "99") 96 Eventually(createSession).Should(Exit(0)) 97 }, stacks[0]) 98 99 helpers.BuildpackWithoutStack(func(buildpackArchive string) { 100 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "100") 101 Eventually(createSession).Should(Exit(0)) 102 }) 103 104 listSession := helpers.CF("buildpacks") 105 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{ 106 Name: buildpackName, Stack: stacks[0]}))) 107 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{Name: buildpackName}))) 108 Eventually(listSession).Should(Exit(0)) 109 }) 110 111 When("no stack association is specified", func() { 112 It("acts on the buildpack with the nil stack", func() { 113 session := helpers.CF("update-buildpack", buildpackName) 114 115 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 116 Eventually(session).Should(Say("OK")) 117 Eventually(session).Should(Exit(0)) 118 }) 119 }) 120 121 When("the user specifies a stack association not matching any of the existing buildpacks with this name", func() { 122 It("reports that it couldn't find the buildpack", func() { 123 nonexistentStack := "some-incorrect-stack-name" 124 session := helpers.CF("update-buildpack", buildpackName, "-s", nonexistentStack) 125 126 Eventually(session.Err).Should(Say("Buildpack %s with stack %s not found", buildpackName, nonexistentStack)) 127 Eventually(session).Should(Say("FAILED")) 128 Eventually(session).Should(Exit(1)) 129 }) 130 }) 131 132 When("the user specifies a stack association matching one of the existing buildpacks with this name", func() { 133 It("finds the buildpack with the stack specified (and not the buildpack with the nil stack)", func() { 134 session := helpers.CF("update-buildpack", buildpackName, "-s", stacks[0]) 135 136 Eventually(session).Should(Say("Updating buildpack %s with stack %s as %s...", 137 buildpackName, stacks[0], username, 138 )) 139 Eventually(session).Should(Say("OK")) 140 Eventually(session).Should(Exit(0)) 141 }) 142 }) 143 }) 144 145 When("multiple buildpacks with the same name exist in enabled and unlocked state, and all have stacks", func() { 146 BeforeEach(func() { 147 helpers.BuildpackWithStack(func(buildpackArchive string) { 148 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "98") 149 Eventually(createSession).Should(Exit(0)) 150 }, stacks[0]) 151 152 helpers.BuildpackWithStack(func(buildpackArchive string) { 153 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "99") 154 Eventually(createSession).Should(Exit(0)) 155 }, stacks[1]) 156 157 listSession := helpers.CF("buildpacks") 158 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{ 159 Name: buildpackName, Stack: stacks[0]}))) 160 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{ 161 Name: buildpackName, Stack: stacks[1]}))) 162 Eventually(listSession).Should(Exit(0)) 163 }) 164 165 When("no stack association is specified", func() { 166 It("reports that it couldn't find the buildpack", func() { 167 session := helpers.CF("update-buildpack", buildpackName) 168 169 Eventually(session.Err).Should(Say("Multiple buildpacks named %s found\\. Specify a stack name by using a '-s' flag\\.", buildpackName)) 170 Eventually(session).Should(Say("FAILED")) 171 Eventually(session).Should(Exit(1)) 172 }) 173 }) 174 175 When("the user specifies a stack association not matching any of the existing buildpacks with this name", func() { 176 It("reports that it couldn't find the buildpack", func() { 177 nonexistentStack := "some-incorrect-stack-name" 178 session := helpers.CF("update-buildpack", buildpackName, "-s", nonexistentStack) 179 180 Eventually(session.Err).Should(Say("Buildpack %s with stack %s not found", buildpackName, nonexistentStack)) 181 Eventually(session).Should(Say("FAILED")) 182 Eventually(session).Should(Exit(1)) 183 }) 184 }) 185 186 When("the user specifies a stack association matching one of the existing buildpacks with this name", func() { 187 It("finds the buildpack with the stack specified (and not the buildpack with the nil stack)", func() { 188 session := helpers.CF("update-buildpack", buildpackName, "-s", stacks[0]) 189 190 Eventually(session).Should(Say("Updating buildpack %s with stack %s as %s...", 191 buildpackName, stacks[0], username, 192 )) 193 Eventually(session).Should(Say("OK")) 194 Eventually(session).Should(Exit(0)) 195 }) 196 }) 197 }) 198 199 When("one buildpack with the given name exists in enabled and unlocked state with a stack association", func() { 200 BeforeEach(func() { 201 helpers.BuildpackWithStack(func(buildpackArchive string) { 202 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "99") 203 Eventually(createSession).Should(Exit(0)) 204 }, stacks[0]) 205 206 listSession := helpers.CF("buildpacks") 207 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{ 208 Name: buildpackName, Stack: stacks[0]}))) 209 Eventually(listSession).Should(Exit(0)) 210 }) 211 212 When("no stack association is specified", func() { 213 It("updates the only buildpack with that name", func() { 214 session := helpers.CF("update-buildpack", buildpackName) 215 216 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 217 Eventually(session).Should(Say("OK")) 218 Eventually(session).Should(Exit(0)) 219 }) 220 }) 221 222 When("the user specifies a stack association not matching any of the existing buildpacks with this name", func() { 223 It("reports that it couldn't find the buildpack", func() { 224 nonexistentStack := "some-incorrect-stack-name" 225 session := helpers.CF("update-buildpack", buildpackName, "-s", nonexistentStack) 226 227 Eventually(session.Err).Should(Say("Buildpack %s with stack %s not found", buildpackName, nonexistentStack)) 228 Eventually(session).Should(Say("FAILED")) 229 Eventually(session).Should(Exit(1)) 230 }) 231 }) 232 233 When("the user specifies a stack association matching one of the existing buildpacks with this name", func() { 234 It("finds the buildpack with the stack specified (and not the buildpack with the nil stack)", func() { 235 session := helpers.CF("update-buildpack", buildpackName, "-s", stacks[0]) 236 237 Eventually(session).Should(Say("Updating buildpack %s with stack %s as %s...", 238 buildpackName, stacks[0], username, 239 )) 240 Eventually(session).Should(Say("OK")) 241 Eventually(session).Should(Exit(0)) 242 }) 243 }) 244 }) 245 }) 246 247 When("one buildpack with given name exists in enabled and unlocked state with no stack association", func() { 248 BeforeEach(func() { 249 helpers.BuildpackWithoutStack(func(buildpackArchive string) { 250 createSession := helpers.CF("create-buildpack", buildpackName, buildpackArchive, "99") 251 Eventually(createSession).Should(Exit(0)) 252 }) 253 254 listSession := helpers.CF("buildpacks") 255 Eventually(listSession).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{Name: buildpackName}))) 256 Eventually(listSession).Should(Exit(0)) 257 }) 258 259 When("only a name is provided", func() { 260 It("prints a success message", func() { 261 session := helpers.CF("update-buildpack", buildpackName) 262 263 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 264 Eventually(session).Should(Say("OK")) 265 Eventually(session).Should(Exit(0)) 266 }) 267 }) 268 269 When("the user provides a stack", func() { 270 var ( 271 stackName string 272 session *Session 273 ) 274 275 JustBeforeEach(func() { 276 stackName = "some-stack" 277 session = helpers.CF("update-buildpack", buildpackName, "-s", stackName) 278 }) 279 280 When("the targeted API does not support stack associations", func() { 281 BeforeEach(func() { 282 helpers.SkipIfVersionAtLeast(ccversion.MinVersionBuildpackStackAssociationV2) 283 }) 284 285 It("fails with a minimum version error", func() { 286 Eventually(session.Err).Should(Say("Option '-s' requires CF API version %s or higher. Your target is %s.", ccversion.MinVersionBuildpackStackAssociationV2, helpers.GetAPIVersionV2())) 287 Eventually(session).Should(Say("FAILED")) 288 Eventually(session).Should(Exit(1)) 289 }) 290 }) 291 292 When("the targeted API supports stack associations", func() { 293 BeforeEach(func() { 294 helpers.SkipIfVersionLessThan(ccversion.MinVersionBuildpackStackAssociationV2) 295 }) 296 297 It("returns a buildpack with stack not found error", func() { 298 Eventually(session.Err).Should(Say("Buildpack %s with stack %s not found", buildpackName, stackName)) 299 Eventually(session).Should(Say("FAILED")) 300 Eventually(session).Should(Exit(1)) 301 }) 302 }) 303 }) 304 305 When("the -p flag is provided", func() { 306 var ( 307 buildpackPath string 308 session *Session 309 ) 310 311 JustBeforeEach(func() { 312 session = helpers.CF("update-buildpack", buildpackName, "-p", buildpackPath) 313 }) 314 315 When("the path is local", func() { 316 When("the buildpack path exists", func() { 317 When("the buildpack path is an empty directory", func() { 318 BeforeEach(func() { 319 var err error 320 buildpackPath, err = ioutil.TempDir("", "create-buildpack-test-") 321 Expect(err).ToNot(HaveOccurred()) 322 }) 323 324 AfterEach(func() { 325 err := os.RemoveAll(buildpackPath) 326 Expect(err).ToNot(HaveOccurred()) 327 }) 328 329 It("prints an error message", func() { 330 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 331 Eventually(session.Err).Should(Say("The specified path '%s' cannot be an empty directory.", regexp.QuoteMeta(buildpackPath))) 332 Eventually(session).Should(Exit(1)) 333 }) 334 }) 335 When("uploading from a directory", func() { 336 BeforeEach(func() { 337 var err error 338 buildpackPath, err = ioutil.TempDir("", "create-buildpack-test-") 339 Expect(err).ToNot(HaveOccurred()) 340 file, err := ioutil.TempFile(buildpackPath, "") 341 defer file.Close() 342 Expect(err).ToNot(HaveOccurred()) 343 }) 344 345 AfterEach(func() { 346 err := os.RemoveAll(buildpackPath) 347 Expect(err).ToNot(HaveOccurred()) 348 }) 349 350 It("updates the buildpack with the given bits", func() { 351 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 352 Eventually(session).Should(Say("OK")) 353 Eventually(session).Should(Exit(0)) 354 }) 355 }) 356 357 When("uploading from a zip", func() { 358 BeforeEach(func() { 359 buildpackPath = helpers.MakeBuildpackArchive("") 360 }) 361 362 AfterEach(func() { 363 err := os.Remove(buildpackPath) 364 Expect(err).NotTo(HaveOccurred()) 365 }) 366 367 It("updates the buildpack with the given bits", func() { 368 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 369 Eventually(session).Should(Say("OK")) 370 Eventually(session).Should(Exit(0)) 371 }) 372 }) 373 }) 374 375 When("the buildpack path does not exist", func() { 376 BeforeEach(func() { 377 buildpackPath = "this-is-a-bogus-path" 378 }) 379 380 It("returns a buildpack does not exist error", func() { 381 Eventually(session.Err).Should(Say("Incorrect Usage: The specified path 'this-is-a-bogus-path' does not exist.")) 382 Eventually(session).Should(Exit(1)) 383 }) 384 }) 385 }) 386 387 When("path is a URL", func() { 388 When("specifying a valid URL", func() { 389 BeforeEach(func() { 390 buildpackPath = "https://github.com/cloudfoundry/binary-buildpack/releases/download/v1.0.21/binary-buildpack-v1.0.21.zip" 391 }) 392 393 It("successfully uploads a buildpack", func() { 394 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 395 Eventually(session).Should(Say("OK")) 396 Eventually(session).Should(Say("Uploading buildpack %s as %s...", buildpackName, username)) 397 Eventually(session).Should(Say("OK")) 398 Eventually(session).Should(Exit(0)) 399 }) 400 }) 401 402 When("a 4xx or 5xx HTTP response status is encountered", func() { 403 var server *Server 404 405 BeforeEach(func() { 406 server = NewServer() 407 // Suppresses ginkgo server logs 408 server.HTTPTestServer.Config.ErrorLog = log.New(&bytes.Buffer{}, "", 0) 409 server.AppendHandlers( 410 CombineHandlers( 411 VerifyRequest(http.MethodGet, "/"), 412 RespondWith(http.StatusNotFound, nil), 413 ), 414 ) 415 buildpackPath = server.URL() 416 }) 417 418 AfterEach(func() { 419 server.Close() 420 }) 421 422 It("displays an appropriate error", func() { 423 Eventually(session.Err).Should(Say("Download attempt failed; server returned 404 Not Found")) 424 Eventually(session.Err).Should(Say("Unable to install; buildpack is not available from the given URL\\.")) 425 Eventually(session).Should(Say("FAILED")) 426 Eventually(session).Should(Exit(1)) 427 }) 428 }) 429 430 When("specifying an invalid URL", func() { 431 BeforeEach(func() { 432 buildpackPath = "http://not-a-real-url" 433 }) 434 435 It("returns the appropriate error", func() { 436 Eventually(session.Err).Should(Say("Get %s: dial tcp: lookup", buildpackPath)) 437 Eventually(session).Should(Say("FAILED")) 438 Eventually(session).Should(Exit(1)) 439 }) 440 }) 441 }) 442 }) 443 444 When("the -i flag is provided", func() { 445 var ( 446 buildpackPosition string 447 session *Session 448 ) 449 450 JustBeforeEach(func() { 451 session = helpers.CF("update-buildpack", buildpackName, "-i", buildpackPosition) 452 }) 453 454 When("position is a negative integer", func() { 455 BeforeEach(func() { 456 buildpackPosition = "-3" 457 }) 458 459 It("successfully uploads buildpack as the first position", func() { 460 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 461 Eventually(session).Should(Say("OK")) 462 Eventually(session).Should(Exit(0)) 463 464 listSession := helpers.CF("buildpacks") 465 Eventually(listSession).Should(Say(`%s\s+1\s`, buildpackName)) 466 Eventually(listSession).Should(Exit(0)) 467 }) 468 }) 469 470 When("position is positive integer", func() { 471 BeforeEach(func() { 472 buildpackPosition = "3" 473 }) 474 475 It("successfully uploads buildpack in the provided position", func() { 476 Eventually(session).Should(Exit(0)) 477 478 listSession := helpers.CF("buildpacks") 479 Eventually(listSession).Should(Say(`%s\s+3\s`, buildpackName)) 480 Eventually(listSession).Should(Exit(0)) 481 }) 482 }) 483 }) 484 485 Describe("flags", func() { 486 When("specifying both enable and disable flags", func() { 487 It("returns the appropriate error", func() { 488 session := helpers.CF("update-buildpack", buildpackName, "--enable", "--disable") 489 Eventually(session.Err).Should(Say("Incorrect Usage: The following arguments cannot be used together: --enable, --disable")) 490 Eventually(session).Should(Say("FAILED")) 491 Eventually(session).Should(Exit(1)) 492 }) 493 }) 494 495 When("specifying both lock and unlock flags", func() { 496 It("returns the appropriate error", func() { 497 session := helpers.CF("update-buildpack", buildpackName, "--lock", "--unlock") 498 Eventually(session.Err).Should(Say("Incorrect Usage: The following arguments cannot be used together: --lock, --unlock")) 499 Eventually(session).Should(Say("FAILED")) 500 Eventually(session).Should(Exit(1)) 501 }) 502 }) 503 504 When("specifying lock flag", func() { 505 It("locks the buildpack", func() { 506 session := helpers.CF("update-buildpack", buildpackName, "--lock") 507 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 508 Eventually(session).Should(Say("OK")) 509 Eventually(session).Should(Exit(0)) 510 511 session = helpers.CF("buildpacks") 512 Eventually(session).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{ 513 Name: buildpackName, 514 Locked: "true", 515 }))) 516 Eventually(session).Should(Exit(0)) 517 }) 518 }) 519 520 When("specifying --lock and -p", func() { 521 It("returns the an error saying that those flags cannot be used together", func() { 522 session := helpers.CF("update-buildpack", buildpackName, "--lock", "-p", "http://google.com") 523 Eventually(session.Err).Should(Say("Incorrect Usage: The following arguments cannot be used together: -p, --lock")) 524 Eventually(session).Should(Say("FAILED")) 525 Eventually(session).Should(Exit(1)) 526 }) 527 }) 528 529 When("specifying --unlock and -p", func() { 530 It("returns the an error saying that those flags cannot be used together", func() { 531 session := helpers.CF("update-buildpack", buildpackName, "--unlock", "-p", "http://google.com") 532 Eventually(session.Err).Should(Say("Incorrect Usage: The following arguments cannot be used together: -p, --unlock")) 533 Eventually(session).Should(Say("FAILED")) 534 Eventually(session).Should(Exit(1)) 535 }) 536 }) 537 538 When("specifying disable flag", func() { 539 It("disables buildpack", func() { 540 session := helpers.CF("update-buildpack", buildpackName, "--disable") 541 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 542 Eventually(session).Should(Say("OK")) 543 Eventually(session).Should(Exit(0)) 544 545 session = helpers.CF("buildpacks") 546 Eventually(session).Should(Say(`%s\s+\d+\s+false`, buildpackName)) 547 Eventually(session).Should(Exit(0)) 548 }) 549 }) 550 }) 551 }) 552 553 When("the buildpack exists and is disabled", func() { 554 BeforeEach(func() { 555 helpers.BuildpackWithoutStack(func(buildpackPath string) { 556 session := helpers.CF("create-buildpack", buildpackName, buildpackPath, "1", "--disable") 557 Eventually(session).Should(Exit(0)) 558 }) 559 }) 560 561 When("specifying enable flag", func() { 562 It("enables buildpack", func() { 563 session := helpers.CF("update-buildpack", buildpackName, "--enable") 564 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 565 Eventually(session).Should(Say("OK")) 566 Eventually(session).Should(Exit(0)) 567 568 session = helpers.CF("buildpacks") 569 Eventually(session).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{Name: buildpackName}))) 570 Eventually(session).Should(Exit(0)) 571 }) 572 }) 573 }) 574 575 When("the buildpack exists and is locked", func() { 576 var buildpackURL string 577 578 BeforeEach(func() { 579 helpers.BuildpackWithoutStack(func(buildpackPath string) { 580 session := helpers.CF("create-buildpack", buildpackName, buildpackPath, "1") 581 Eventually(session).Should(Exit(0)) 582 session = helpers.CF("update-buildpack", buildpackName, "--lock") 583 Eventually(session).Should(Exit(0)) 584 }) 585 buildpackURL = "https://github.com/cloudfoundry/binary-buildpack/releases/download/v1.0.21/binary-buildpack-v1.0.21.zip" 586 }) 587 588 Context("specifying -p argument", func() { 589 It("fails to update buildpack", func() { 590 session := helpers.CF("update-buildpack", buildpackName, "-p", buildpackURL) 591 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 592 Eventually(session).Should(Say("FAILED")) 593 Eventually(session.Err).Should(Say("The buildpack is locked")) 594 Eventually(session).Should(Exit(1)) 595 }) 596 }) 597 598 Context("specifying unlock flag", func() { 599 It("unlocks the buildpack", func() { 600 session := helpers.CF("update-buildpack", buildpackName, "--unlock") 601 Eventually(session).Should(Say("Updating buildpack %s as %s...", buildpackName, username)) 602 Eventually(session).Should(Say("OK")) 603 Eventually(session).Should(Exit(0)) 604 605 session = helpers.CF("buildpacks") 606 Eventually(session).Should(Say(helpers.BuildpacksOutputRegex(helpers.BuildpackFields{Name: buildpackName}))) 607 Eventually(session).Should(Exit(0)) 608 }) 609 }) 610 }) 611 }) 612 }) 613 })