github.com/wanddynosios/cli@v7.1.0+incompatible/integration/v6/push/tcp_random_route_test.go (about)

     1  package push
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("TCP random route", func() {
    12  	var (
    13  		appName string
    14  	)
    15  
    16  	BeforeEach(func() {
    17  		appName = "short-app-name" // used on purpose to fit route length requirement
    18  	})
    19  
    20  	When("passed the --random-route flag", func() {
    21  		When("also passed a tcp domain", func() {
    22  			var domain helpers.Domain
    23  
    24  			BeforeEach(func() {
    25  				domainName := helpers.NewDomainName("tcp-domain")
    26  				domain = helpers.NewDomain(organization, domainName)
    27  				domain.CreateWithRouterGroup(helpers.FindOrCreateTCPRouterGroup(GinkgoParallelNode()))
    28  			})
    29  
    30  			AfterEach(func() {
    31  				domain.DeleteShared()
    32  			})
    33  
    34  			It("creates a new route with the provided domain", func() {
    35  				helpers.WithHelloWorldApp(func(dir string) {
    36  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--random-route", "-d", domain.Name, "--no-start")
    37  					Eventually(session).Should(Say(`\+\s+%s:\?\?\?\?`, domain.Name))
    38  					Eventually(session).Should(Exit(0))
    39  				})
    40  			})
    41  
    42  			When("the app already exists with a tcp route", func() {
    43  				BeforeEach(func() {
    44  					helpers.WithHelloWorldApp(func(dir string) {
    45  						Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--random-route", "-d", domain.Name, "--no-start")).Should(Exit(0))
    46  					})
    47  				})
    48  
    49  				It("does not create any new routes", func() {
    50  					helpers.WithHelloWorldApp(func(dir string) {
    51  						session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--random-route", "-d", domain.Name, "--no-start")
    52  						Consistently(session).ShouldNot(Say(`\+\s+%s:`, domain.Name))
    53  						Eventually(session).Should(Exit(0))
    54  					})
    55  				})
    56  			})
    57  		})
    58  	})
    59  })