github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/integration/v7/push/rolling_push_test.go (about) 1 package push 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 . "github.com/onsi/gomega/gbytes" 8 . "github.com/onsi/gomega/gexec" 9 ) 10 11 var _ = Describe("push with --strategy rolling", func() { 12 var ( 13 appName string 14 userName string 15 ) 16 17 BeforeEach(func() { 18 appName = helpers.PrefixedRandomName("app") 19 userName, _ = helpers.GetCredentials() 20 }) 21 22 When("the app exists", func() { 23 BeforeEach(func() { 24 helpers.WithHelloWorldApp(func(appDir string) { 25 Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 26 PushCommandName, appName, 27 )).Should(Exit(0)) 28 }) 29 }) 30 31 It("pushes the app and creates a new deployment", func() { 32 helpers.WithHelloWorldApp(func(appDir string) { 33 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 34 PushCommandName, appName, "--strategy", "rolling", 35 ) 36 37 Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) 38 Eventually(session).Should(Say(`Packaging files to upload\.\.\.`)) 39 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 40 Eventually(session).Should(Say(`100.00%`)) 41 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 42 Eventually(session).Should(Say(`Staging app and tracing logs\.\.\.`)) 43 Eventually(session).Should(Say(`Starting deployment for app %s\.\.\.`, appName)) 44 Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) 45 Eventually(session).Should(Say(`name:\s+%s`, appName)) 46 Eventually(session).Should(Say(`requested state:\s+started`)) 47 Eventually(session).Should(Say(`routes:\s+%s.%s`, appName, helpers.DefaultSharedDomain())) 48 Eventually(session).Should(Say(`type:\s+web`)) 49 Eventually(session).Should(Say(`start command:\s+%s`, helpers.StaticfileBuildpackStartCommand)) 50 Eventually(session).Should(Say(`#0\s+running`)) 51 Eventually(session).Should(Exit(0)) 52 }) 53 }) 54 }) 55 56 When("canceling the deployment", func() { 57 BeforeEach(func() { 58 helpers.WithHelloWorldApp(func(appDir string) { 59 Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 60 PushCommandName, appName, 61 )).Should(Exit(0)) 62 }) 63 }) 64 65 It("displays the deployment cancellation message", func() { 66 helpers.WithHelloWorldApp(func(appDir string) { 67 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 68 PushCommandName, appName, "--strategy", "rolling", 69 ) 70 71 Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) 72 Eventually(session).Should(Say(`Packaging files to upload\.\.\.`)) 73 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 74 Eventually(session).Should(Say(`100.00%`)) 75 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 76 Eventually(session).Should(Say(`Staging app and tracing logs\.\.\.`)) 77 Eventually(session).Should(Say(`Starting deployment for app %s\.\.\.`, appName)) 78 Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) 79 80 Eventually(helpers.CF("cancel-deployment", appName)).Should(Exit(0)) 81 Eventually(session).Should(Say(`FAILED`)) 82 Eventually(session.Err).Should(Say(`Deployment has been canceled`)) 83 Eventually(session).Should(Exit(1)) 84 }) 85 }) 86 }) 87 88 When("the app crashes", func() { 89 BeforeEach(func() { 90 helpers.WithHelloWorldApp(func(appDir string) { 91 Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 92 PushCommandName, appName, 93 )).Should(Exit(0)) 94 }) 95 }) 96 97 It("times out", func() { 98 helpers.WithCrashingApp(func(appDir string) { 99 session := helpers.CustomCF(helpers.CFEnv{ 100 WorkingDirectory: appDir, 101 EnvVars: map[string]string{"CF_STARTUP_TIMEOUT": "0.1"}, 102 }, PushCommandName, appName, "--strategy", "rolling") 103 Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) 104 Eventually(session).Should(Say(`Packaging files to upload\.\.\.`)) 105 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 106 Eventually(session).Should(Say(`100.00%`)) 107 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 108 Eventually(session).Should(Say(`Staging app and tracing logs\.\.\.`)) 109 Eventually(session).Should(Say(`Starting deployment for app %s\.\.\.`, appName)) 110 Eventually(session).Should(Say(`Waiting for app to deploy\.\.\.`)) 111 Eventually(session).Should(Say(`FAILED`)) 112 Eventually(session.Err).Should(Say(`Start app timeout`)) 113 Eventually(session.Err).Should(Say(`TIP: Application must be listening on the right port\. Instead of hard coding the port, use the \$PORT environment variable\.`)) 114 Eventually(session.Err).Should(Say(`Use 'cf logs %s --recent' for more information`, appName)) 115 Eventually(session).Should(Exit(1)) 116 }) 117 }) 118 }) 119 })