github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v7/push/no_route_test.go (about)

     1  package push
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     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("no-route", func() {
    14  
    15  	var (
    16  		appName string
    17  	)
    18  
    19  	BeforeEach(func() {
    20  		appName = helpers.PrefixedRandomName("app")
    21  	})
    22  
    23  	When("the --no-route flag is set", func() {
    24  
    25  		It("does not map any routes to the app", func() {
    26  			helpers.WithHelloWorldApp(func(appDir string) {
    27  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, PushCommandName, appName, "--no-route")
    28  				Consistently(session).ShouldNot(Say(`Mapping routes\.\.\.`))
    29  				Eventually(session).Should(Say(`name:\s+%s`, appName))
    30  				Eventually(session).Should(Say(`requested state:\s+started`))
    31  				Eventually(session).Should(Say(`(?m)routes:\s+\n`))
    32  				Eventually(session).Should(Exit(0))
    33  			})
    34  		})
    35  	})
    36  
    37  	When("the no-route is in the manifest", func() {
    38  		It("does not map any routes to the app", func() {
    39  			helpers.WithHelloWorldApp(func(appDir string) {
    40  				manifestPath := filepath.Join(appDir, "manifest.yml")
    41  				helpers.WriteManifest(manifestPath, map[string]interface{}{
    42  					"applications": []map[string]interface{}{
    43  						{
    44  							"name":     appName,
    45  							"no-route": true,
    46  						},
    47  					},
    48  				})
    49  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, PushCommandName, appName)
    50  				Consistently(session).ShouldNot(Say(`Mapping routes\.\.\.`))
    51  				Eventually(session).Should(Say(`name:\s+%s`, appName))
    52  				Eventually(session).Should(Say(`requested state:\s+started`))
    53  				Eventually(session).Should(Say(`(?m)routes:\s+\n`))
    54  				Eventually(session).Should(Exit(0))
    55  			})
    56  		})
    57  	})
    58  })