github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/integration/isolated/copy_source_command_test.go (about) 1 package isolated 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "net/http" 7 8 "code.cloudfoundry.org/cli/integration/helpers" 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("copy-source command", func() { 16 var ( 17 appName1 string 18 appName2 string 19 orgName string 20 spaceName string 21 ) 22 23 BeforeEach(func() { 24 orgName = helpers.NewOrgName() 25 spaceName = helpers.NewSpaceName() 26 27 setupCF(orgName, spaceName) 28 29 appName1 = helpers.PrefixedRandomName("hello") 30 appName2 = helpers.PrefixedRandomName("banana") 31 32 helpers.WithHelloWorldApp(func(appDir string) { 33 Eventually(helpers.CF("push", appName1, "--no-start", "-p", appDir, "-b", "staticfile_buildpack", "--no-route")).Should(Exit(0)) 34 }) 35 36 helpers.WithBananaPantsApp(func(appDir string) { 37 Eventually(helpers.CF("push", appName2, "--no-start", "-p", appDir, "-b", "staticfile_buildpack")).Should(Exit(0)) 38 }) 39 }) 40 41 AfterEach(func() { 42 helpers.QuickDeleteOrg(orgName) 43 }) 44 45 It("copies the app", func() { 46 session := helpers.CF("copy-source", appName1, appName2) 47 Eventually(session).Should(Say("Copying source from app %s to target app %s", appName1, appName2)) 48 Eventually(session).Should(Say("Showing health and status for app %s", appName2)) 49 Eventually(session).Should(Exit(0)) 50 51 resp, err := http.Get(fmt.Sprintf("http://%s.%s", appName2, defaultSharedDomain())) 52 Expect(err).ToNot(HaveOccurred()) 53 defer resp.Body.Close() 54 body, err := ioutil.ReadAll(resp.Body) 55 Expect(err).ToNot(HaveOccurred()) 56 Expect(string(body)).To(MatchRegexp("hello world")) 57 }) 58 })