github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/integration/v6/push/no_hostname_test.go (about) 1 package push 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 5 "code.cloudfoundry.org/cli/integration/helpers" 6 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 . "github.com/onsi/gomega/gbytes" 10 . "github.com/onsi/gomega/gexec" 11 ) 12 13 var _ = Describe("pushing with no-hostname", func() { 14 var ( 15 appName string 16 domainName string 17 ) 18 19 BeforeEach(func() { 20 appName = helpers.NewAppName() 21 domainName = helpers.NewDomainName() 22 }) 23 24 When("pushing with no manifest", func() { 25 When("using a private domain", func() { 26 var domain helpers.Domain 27 28 BeforeEach(func() { 29 domain = helpers.NewDomain(organization, domainName) 30 domain.Create() 31 }) 32 33 AfterEach(func() { 34 domain.Delete() 35 }) 36 37 It("creates a route with no hostname", func() { 38 helpers.WithHelloWorldApp(func(dir string) { 39 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-hostname", "-d", domainName, "--no-start") 40 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 41 Eventually(session).Should(Say(`\+\s+%s`, domainName)) 42 Eventually(session).Should(Exit(0)) 43 }) 44 45 session := helpers.CF("app", appName) 46 Eventually(session).Should(Say(`name:\s+%s`, appName)) 47 Eventually(session).Should(Say(`(?m)routes:\s+%s`, domainName)) 48 Eventually(session).Should(Exit(0)) 49 }) 50 }) 51 52 When("using a shared domain", func() { 53 When("using an HTTP domain", func() { 54 It("returns an invalid route error", func() { 55 helpers.WithHelloWorldApp(func(dir string) { 56 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-hostname", "--no-start") 57 Eventually(session.Err).Should(Say("The route is invalid: a hostname is required for shared domains.")) 58 Eventually(session).Should(Exit(1)) 59 }) 60 }) 61 }) 62 63 When("using a TCP domain", func() { 64 var domain helpers.Domain 65 66 BeforeEach(func() { 67 helpers.SkipIfVersionLessThan(ccversion.MinVersionRoutingV3) 68 69 domain = helpers.NewDomain(organization, domainName) 70 domain.CreateWithRouterGroup(helpers.FindOrCreateTCPRouterGroup(GinkgoParallelNode())) 71 }) 72 73 AfterEach(func() { 74 domain.DeleteShared() 75 }) 76 77 It("creates a TCP route", func() { 78 helpers.WithHelloWorldApp(func(dir string) { 79 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-hostname", "-d", domainName, "--no-start") 80 Eventually(session).Should(Say(`\+\s+name:\s+%s`, appName)) 81 Eventually(session).Should(Say(`\+\s+%s:`, domainName)) 82 Eventually(session).Should(Exit(0)) 83 }) 84 85 session := helpers.CF("app", appName) 86 Eventually(session).Should(Say(`name:\s+%s`, appName)) 87 Eventually(session).Should(Say(`(?m)routes:\s+%s:\d+`, domainName)) 88 Eventually(session).Should(Exit(0)) 89 }) 90 }) 91 }) 92 }) 93 })