github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/v7/push/push_output_test.go (about) 1 package push 2 3 import ( 4 "path/filepath" 5 "regexp" 6 "time" 7 8 "code.cloudfoundry.org/cli/integration/helpers" 9 10 . "github.com/onsi/ginkgo" 11 . "github.com/onsi/gomega" 12 . "github.com/onsi/gomega/gbytes" 13 . "github.com/onsi/gomega/gexec" 14 ) 15 16 var _ = Describe("Output", func() { 17 var ( 18 appName string 19 appName2 string 20 21 username string 22 ) 23 24 BeforeEach(func() { 25 appName = helpers.NewAppName() 26 appName2 = helpers.NewAppName() 27 username, _ = helpers.GetCredentials() 28 }) 29 30 When("there is a manifest", func() { 31 It("prints the manifests path and other output", func() { 32 helpers.WithHelloWorldApp(func(dir string) { 33 helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{ 34 "applications": []map[string]interface{}{ 35 {"name": appName}, 36 {"name": appName2}, 37 }, 38 }) 39 40 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName) 41 Eventually(session).Should(Say(`Pushing apps %s, %s to org %s / space %s as %s\.\.\.`, appName, appName2, organization, space, username)) 42 Eventually(session).Should(helpers.SayPath(`Applying manifest file %s`, filepath.Join(dir, "manifest.yml"))) 43 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 44 Eventually(session).Should(Say("100.00%")) 45 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 46 helpers.ConfirmStagingLogs(session) 47 Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName)) 48 Eventually(session).Should(Say(`requested state:\s+started`)) 49 Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand))) 50 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 51 Eventually(session).Should(Say("100.00%")) 52 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 53 helpers.ConfirmStagingLogs(session) 54 Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName2)) 55 Eventually(session).Should(Say(`requested state:\s+started`)) 56 Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand))) 57 Eventually(session).Should(Exit(0)) 58 }) 59 }) 60 }) 61 62 When("there is no a manifest", func() { 63 It("does not display any manifest information", func() { 64 helpers.WithHelloWorldApp(func(dir string) { 65 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName) 66 Consistently(session).ShouldNot(Say(`Applying manifest`)) 67 Consistently(session, 10*time.Second).ShouldNot(Say(`Manifest applied`)) 68 Eventually(session).Should(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, username)) 69 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 70 Eventually(session).Should(Say("100.00%")) 71 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 72 helpers.ConfirmStagingLogs(session) 73 Eventually(session).Should(Say(`Waiting for app %s to start\.\.\.`, appName)) 74 Eventually(session).Should(Say(`requested state:\s+started`)) 75 Eventually(session).Should(Say(`start command:\s+%s`, regexp.QuoteMeta(helpers.ModernStaticfileBuildpackStartCommand))) 76 Eventually(session).Should(Exit(0)) 77 }) 78 }) 79 }) 80 })