github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/integration/v6/experimental/v3_push_no_start_test.go (about)

     1  package experimental
     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("v3-push with --no-start", func() {
    12  	var (
    13  		orgName   string
    14  		spaceName string
    15  		appName   string
    16  		userName  string
    17  	)
    18  
    19  	BeforeEach(func() {
    20  		orgName = helpers.NewOrgName()
    21  		spaceName = helpers.NewSpaceName()
    22  		appName = helpers.PrefixedRandomName("app")
    23  		userName, _ = helpers.GetCredentials()
    24  		helpers.TurnOffExperimental()
    25  	})
    26  
    27  	AfterEach(func() {
    28  		helpers.TurnOnExperimental()
    29  	})
    30  
    31  	When("the environment is set up correctly", func() {
    32  		BeforeEach(func() {
    33  			helpers.SetupCF(orgName, spaceName)
    34  		})
    35  
    36  		AfterEach(func() {
    37  			helpers.QuickDeleteOrg(orgName)
    38  		})
    39  
    40  		When("the app exists and is already running", func() {
    41  			var session *Session
    42  
    43  			BeforeEach(func() {
    44  				helpers.WithHelloWorldApp(func(appDir string) {
    45  					Eventually(helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "v3-push", appName)).Should(Exit(0))
    46  				})
    47  			})
    48  
    49  			It("uploads the app, does not restage or restart it, and stops the initial app", func() {
    50  				helpers.WithHelloWorldApp(func(appDir string) {
    51  					session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "v3-push", appName, "--no-start")
    52  					Eventually(session).Should(Say("Updating app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    53  					Eventually(session).Should(Say("OK"))
    54  					Eventually(session).Should(Say(""))
    55  					Eventually(session).Should(Say("Uploading and creating bits package for app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    56  					Eventually(session).Should(Say("OK"))
    57  					Eventually(session).Should(Say(""))
    58  					Eventually(session).Should(Say("Stopping app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    59  					Eventually(session).Should(Say("OK"))
    60  					Eventually(session).Should(Say(""))
    61  					Consistently(session).ShouldNot(Say("Staging package for app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    62  					Consistently(session).ShouldNot(Say("Starting app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    63  					Eventually(session).Should(Exit(0))
    64  				})
    65  
    66  				session = helpers.CF("app", appName)
    67  
    68  				Eventually(session).Should(Say("name:\\s+%s", appName))
    69  				Eventually(session).Should(Say("requested state:\\s+stopped"))
    70  
    71  				Eventually(session).Should(Say("type:\\s+web"))
    72  				Eventually(session).Should(Say("instances:\\s+0/1"))
    73  
    74  				Eventually(session).Should(Exit(0))
    75  			})
    76  		})
    77  
    78  		When("the app does not exist", func() {
    79  			var session *Session
    80  
    81  			It("uploads the app, does not restage or restart it", func() {
    82  				helpers.WithHelloWorldApp(func(appDir string) {
    83  					session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, "v3-push", appName, "--no-start")
    84  					Eventually(session).Should(Say("Creating app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    85  					Eventually(session).Should(Say("OK"))
    86  					Eventually(session).Should(Say(""))
    87  					Eventually(session).Should(Say("Uploading and creating bits package for app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    88  					Eventually(session).Should(Say("OK"))
    89  					Eventually(session).Should(Say(""))
    90  					Consistently(session).ShouldNot(Say("Staging package for app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    91  					Consistently(session).ShouldNot(Say("Starting app %s in org %s / space %s as %s\\.\\.\\.", appName, orgName, spaceName, userName))
    92  
    93  					Eventually(session).Should(Exit(0))
    94  				})
    95  			})
    96  		})
    97  	})
    98  })