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