github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/integration/v7/push/instances_flag_test.go (about)

     1  package push
     2  
     3  import (
     4  	"time"
     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("push with instances flag", func() {
    14  	var (
    15  		appName string
    16  	)
    17  
    18  	BeforeEach(func() {
    19  		appName = helpers.NewAppName()
    20  	})
    21  
    22  	Context("when the -i flag is provided with an instance count", func() {
    23  		It("creates the app with the specified number of web instances", func() {
    24  			helpers.WithHelloWorldApp(func(dir string) {
    25  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    26  					PushCommandName, appName,
    27  					"-i", "3",
    28  				)
    29  				Eventually(session).Should(Exit(0))
    30  			})
    31  
    32  			time.Sleep(5 * time.Second)
    33  			session := helpers.CF("app", appName)
    34  			Eventually(session).Should(Say(`name:\s+%s`, appName))
    35  			Eventually(session).Should(Say(`last uploaded:\s+%s`, helpers.ReadableDateTimeRegex))
    36  			Eventually(session).Should(Say(`\s+state\s+since\s+cpu\s+memory\s+disk`))
    37  			Eventually(session).Should(Say(`#0\s+(running|starting)\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`))
    38  			Eventually(session).Should(Say(`#1\s+(running|starting)\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`))
    39  			Eventually(session).Should(Say(`#2\s+(running|starting)\s+\d{4}-[01]\d-[0-3]\dT[0-2][0-9]:[0-5]\d:[0-5]\dZ`))
    40  			Eventually(session).Should(Exit(0))
    41  		})
    42  	})
    43  })