github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+incompatible/integration/v7/push/stacks_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("stack", func() { 12 var ( 13 appName string 14 ) 15 16 BeforeEach(func() { 17 appName = helpers.PrefixedRandomName("app") 18 }) 19 20 When("the --stack flag is provided", func() { 21 It("successfully pushes the app with the provided stack", func() { 22 helpers.WithHelloWorldApp(func(appDir string) { 23 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 24 PushCommandName, appName, 25 "--stack", WindowsStack, 26 "--no-start", 27 ) 28 Eventually(session).Should(Exit(0)) 29 Expect(helpers.AppJSON(appName)).To(MatchRegexp(`"stack":\s*"%s"`, WindowsStack)) 30 }) 31 }) 32 33 It("fails to push the app with an invalid stack", func() { 34 helpers.WithHelloWorldApp(func(appDir string) { 35 session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: appDir}, 36 PushCommandName, appName, 37 "--stack", "invalidStack", 38 ) 39 40 Eventually(session.Err).Should(Say(`Stack must be an existing stack`)) 41 Eventually(session).Should(Say("FAILED")) 42 Eventually(session).Should(Exit(1)) 43 }) 44 }) 45 }) 46 })