github.com/loafoe/cli@v7.1.0+incompatible/integration/v6/push/select_app_to_push_from_manifest_test.go (about) 1 package push 2 3 import ( 4 "path/filepath" 5 6 "code.cloudfoundry.org/cli/integration/helpers" 7 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("pushes specified app from single manifest file", func() { 15 var ( 16 firstApp string 17 secondApp string 18 ) 19 20 BeforeEach(func() { 21 firstApp = helpers.NewAppName() 22 secondApp = helpers.NewAppName() 23 }) 24 25 When("the specified app is not found in the manifest file", func() { 26 It("returns an error", func() { 27 helpers.WithHelloWorldApp(func(dir string) { 28 helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{ 29 "applications": []map[string]string{ 30 { 31 "name": firstApp, 32 }, 33 { 34 "name": secondApp, 35 }, 36 }, 37 }) 38 39 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, "some-app-not-from-manifest") 40 41 Eventually(session).Should(Say("FAILED")) 42 Eventually(session.Err).Should(Say("Could not find app named 'some-app-not-from-manifest' in manifest")) 43 44 Eventually(session).Should(Exit(1)) 45 }) 46 }) 47 }) 48 49 When("the specified app exists in the manifest file", func() { 50 It("pushes just the app on the command line", func() { 51 helpers.WithHelloWorldApp(func(dir string) { 52 helpers.WriteManifest(filepath.Join(dir, "manifest.yml"), map[string]interface{}{ 53 "applications": []map[string]string{ 54 { 55 "name": firstApp, 56 }, 57 { 58 "name": secondApp, 59 }, 60 }, 61 }) 62 63 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, firstApp) 64 Eventually(session).Should(Say(`Getting app info\.\.\.`)) 65 66 Eventually(session).Should(Say(`Creating app with these attributes\.\.\.`)) 67 Eventually(session).Should(Say(`\+\s+name:\s+%s`, firstApp)) 68 Eventually(session).Should(helpers.SayPath(`path:\s+%s`, dir)) 69 Eventually(session).Should(Say(`\s+routes:`)) 70 Eventually(session).Should(Say(`(?i)\+\s+%s.%s`, firstApp, helpers.DefaultSharedDomain())) 71 Eventually(session).Should(Say(`Mapping routes\.\.\.`)) 72 Eventually(session).Should(Say(`Uploading files\.\.\.`)) 73 Eventually(session).Should(Say("100.00%")) 74 Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`)) 75 helpers.ConfirmStagingLogs(session) 76 Eventually(session).Should(Say(`Waiting for app to start\.\.\.`)) 77 Eventually(session).Should(Say(`requested state:\s+started`)) 78 79 Consistently(session).ShouldNot(Say(`\+\s+name:\s+%s`, secondApp)) 80 Eventually(session).Should(Exit(0)) 81 }) 82 83 session := helpers.CF("app", firstApp) 84 Eventually(session).Should(Say(`name:\s+%s`, firstApp)) 85 Eventually(session).Should(Exit(0)) 86 87 session = helpers.CF("app", secondApp) 88 Eventually(session).ShouldNot(Say(`name:\s+%s`, secondApp)) 89 Eventually(session).Should(Exit(1)) 90 }) 91 }) 92 })