github.com/loafoe/cli@v7.1.0+incompatible/integration/v6/push/no_start_test.go (about) 1 package push 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 . "github.com/onsi/gomega/gbytes" 9 . "github.com/onsi/gomega/gexec" 10 ) 11 12 var _ = Describe("push with --no-start", func() { 13 var ( 14 appName string 15 ) 16 17 BeforeEach(func() { 18 appName = helpers.NewAppName() 19 }) 20 21 When("the app is new", func() { 22 It("pushes the app without starting it", func() { 23 helpers.WithHelloWorldApp(func(dir string) { 24 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start") 25 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 26 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 27 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 28 Eventually(session).Should(Say("100.00%")) 29 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 30 Eventually(session).Should(Say(`requested state:\s+stopped`)) 31 Eventually(session).Should(Exit(0)) 32 }) 33 34 session := helpers.CF("app", appName) 35 Eventually(session).Should(Say(`name:\s+%s`, appName)) 36 Eventually(session).Should(Say(`requested state:\s+stopped`)) 37 Eventually(session).Should(Exit(0)) 38 }) 39 }) 40 41 When("the app exists", func() { 42 When("the app is running", func() { 43 BeforeEach(func() { 44 helpers.WithHelloWorldApp(func(dir string) { 45 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName) 46 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 47 Eventually(session).Should(Say(`requested state:\s+started`)) 48 Eventually(session).Should(Exit(0)) 49 }) 50 }) 51 52 It("stops the app", func() { 53 helpers.WithHelloWorldApp(func(dir string) { 54 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start") 55 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 56 Eventually(session).Should(Say(`\s+name:\s+%s`, appName)) 57 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 58 Eventually(session).Should(Say("100.00%")) 59 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 60 Eventually(session).Should(Say(`requested state:\s+stopped`)) 61 Eventually(session).Should(Exit(0)) 62 }) 63 64 session := helpers.CF("app", appName) 65 Eventually(session).Should(Say(`name:\s+%s`, appName)) 66 Eventually(session).Should(Say(`requested state:\s+stopped`)) 67 Eventually(session).Should(Exit(0)) 68 }) 69 }) 70 71 When("the app is stopped", func() { 72 BeforeEach(func() { 73 helpers.WithHelloWorldApp(func(dir string) { 74 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start") 75 Eventually(session).Should(Say(`\s+name:\s+%s`, appName)) 76 Eventually(session).Should(Say(`requested state:\s+stopped`)) 77 Eventually(session).Should(Exit(0)) 78 }) 79 }) 80 81 It("the app remains stopped", func() { 82 helpers.WithHelloWorldApp(func(dir string) { 83 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start") 84 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 85 Eventually(session).Should(Say(`\s+name:\s+%s`, appName)) 86 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 87 Eventually(session).Should(Say("100.00%")) 88 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 89 Eventually(session).Should(Say(`requested state:\s+stopped`)) 90 Eventually(session).Should(Exit(0)) 91 }) 92 93 session := helpers.CF("app", appName) 94 Eventually(session).Should(Say(`name:\s+%s`, appName)) 95 Eventually(session).Should(Say(`requested state:\s+stopped`)) 96 Eventually(session).Should(Exit(0)) 97 }) 98 }) 99 }) 100 })