github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/push/no_start_test.go (about)

     1  package push
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  	. "github.com/onsi/gomega/gbytes"
     9  	. "github.com/onsi/gomega/gexec"
    10  )
    11  
    12  var _ = Describe("push with --no-start", func() {
    13  	var (
    14  		appName string
    15  	)
    16  
    17  	BeforeEach(func() {
    18  		appName = helpers.NewAppName()
    19  	})
    20  
    21  	When("the app is new", func() {
    22  		It("pushes the app without starting it", func() {
    23  			helpers.WithHelloWorldApp(func(dir string) {
    24  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start")
    25  				Eventually(session).Should(Say(`Uploading files\.\.\.`))
    26  				Eventually(session).Should(Say("100.00%"))
    27  				Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    28  				Eventually(session).Should(Say(`\s+name:\s+%s`, appName))
    29  				Eventually(session).Should(Say(`requested state:\s+stopped`))
    30  				Eventually(session).Should(Say(`routes:\s+%s.%s`, appName, helpers.DefaultSharedDomain()))
    31  				Eventually(session).Should(Exit(0))
    32  			})
    33  
    34  			session := helpers.CF("app", appName)
    35  			Eventually(session).Should(Say(`name:\s+%s`, appName))
    36  			Eventually(session).Should(Say(`requested state:\s+stopped`))
    37  			Eventually(session).Should(Exit(0))
    38  		})
    39  	})
    40  
    41  	When("the app exists", func() {
    42  		When("the app is running", func() {
    43  			BeforeEach(func() {
    44  				helpers.WithHelloWorldApp(func(dir string) {
    45  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName)
    46  					Eventually(session).Should(Say(`\s+name:\s+%s`, appName))
    47  					Eventually(session).Should(Say(`requested state:\s+started`))
    48  					Eventually(session).Should(Exit(0))
    49  				})
    50  			})
    51  
    52  			It("stops the app", func() {
    53  				helpers.WithHelloWorldApp(func(dir string) {
    54  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start")
    55  					Eventually(session).Should(Say(`Uploading files\.\.\.`))
    56  					Eventually(session).Should(Say("100.00%"))
    57  					Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    58  					Eventually(session).Should(Say(`\s+name:\s+%s`, appName))
    59  					Eventually(session).Should(Say(`requested state:\s+stopped`))
    60  					Eventually(session).Should(Exit(0))
    61  				})
    62  
    63  				session := helpers.CF("app", appName)
    64  				Eventually(session).Should(Say(`name:\s+%s`, appName))
    65  				Eventually(session).Should(Say(`requested state:\s+stopped`))
    66  				Eventually(session).Should(Exit(0))
    67  			})
    68  		})
    69  
    70  		When("the app is stopped", func() {
    71  			BeforeEach(func() {
    72  				helpers.WithHelloWorldApp(func(dir string) {
    73  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start")
    74  					Eventually(session).Should(Say(`\s+name:\s+%s`, appName))
    75  					Eventually(session).Should(Say(`requested state:\s+stopped`))
    76  					Eventually(session).Should(Exit(0))
    77  				})
    78  			})
    79  
    80  			It("the app remains stopped", func() {
    81  				helpers.WithHelloWorldApp(func(dir string) {
    82  					session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir}, PushCommandName, appName, "--no-start")
    83  					Eventually(session).Should(Say(`Uploading files\.\.\.`))
    84  					Eventually(session).Should(Say("100.00%"))
    85  					Eventually(session).Should(Say(`Waiting for API to complete processing files\.\.\.`))
    86  					Eventually(session).Should(Say(`\s+name:\s+%s`, appName))
    87  					Eventually(session).Should(Say(`requested state:\s+stopped`))
    88  					Eventually(session).Should(Exit(0))
    89  				})
    90  
    91  				session := helpers.CF("app", appName)
    92  				Eventually(session).Should(Say(`name:\s+%s`, appName))
    93  				Eventually(session).Should(Say(`requested state:\s+stopped`))
    94  				Eventually(session).Should(Exit(0))
    95  			})
    96  		})
    97  	})
    98  })