github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/integration/push/buildpack_test.go (about)

     1  package push
     2  
     3  import (
     4  	"fmt"
     5  	"io/ioutil"
     6  	"math/rand"
     7  	"path/filepath"
     8  
     9  	"code.cloudfoundry.org/cli/integration/helpers"
    10  
    11  	. "github.com/onsi/ginkgo"
    12  	. "github.com/onsi/gomega"
    13  	. "github.com/onsi/gomega/gbytes"
    14  	. "github.com/onsi/gomega/gexec"
    15  )
    16  
    17  var _ = Describe("push with different buildpack values", func() {
    18  	var (
    19  		appName string
    20  	)
    21  
    22  	BeforeEach(func() {
    23  		Skip("unblock when story #150452499 is unblocked")
    24  		appName = helpers.NewAppName()
    25  	})
    26  
    27  	Context("when the buildpack flag is provided", func() {
    28  		It("sets that buildpack correctly for the pushed app", func() {
    29  			helpers.WithProcfileApp(func(dir string) {
    30  				tempfile := filepath.Join(dir, "index.html")
    31  				err := ioutil.WriteFile(tempfile, []byte(fmt.Sprintf("hello world %d", rand.Int())), 0666)
    32  				Expect(err).ToNot(HaveOccurred())
    33  
    34  				By("pushing a ruby app with a static buildpack sets buildpack to static")
    35  				session := helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    36  					PushCommandName, appName,
    37  					"-b", "staticfile_buildpack",
    38  				)
    39  				Eventually(session).Should(Say("Staticfile Buildpack"))
    40  				Eventually(session).Should(Exit(0))
    41  
    42  				session = helpers.CF("app", appName)
    43  				Eventually(session).Should(Say("buildpack:\\s+staticfile_buildpack"))
    44  				Eventually(session).Should(Exit(0))
    45  
    46  				By("pushing a ruby app with a null buildpack sets buildpack to auto-detected (ruby)")
    47  				session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    48  					PushCommandName, appName,
    49  					"-b", "null",
    50  				)
    51  				Eventually(session).Should(Say(`\-\s+buildpack:\s+staticfile_buildpack`))
    52  				Consistently(session).ShouldNot(Say(`\+\s+buildpack:`))
    53  				Eventually(session).Should(Say("Ruby Buildpack"))
    54  				Eventually(session).Should(Exit(0))
    55  
    56  				session = helpers.CF("app", appName)
    57  				Eventually(session).Should(Say(`buildpack:\s+ruby_buildpack`))
    58  				Eventually(session).Should(Exit(0))
    59  
    60  				By("pushing a ruby app with a static buildpack sets buildpack to static")
    61  				session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    62  					PushCommandName, appName,
    63  					"-b", "staticfile_buildpack",
    64  				)
    65  				Eventually(session).Should(Say("Staticfile Buildpack"))
    66  				Eventually(session).Should(Exit(0))
    67  
    68  				session = helpers.CF("app", appName)
    69  				Eventually(session).Should(Say("buildpack:\\s+staticfile_buildpack"))
    70  				Eventually(session).Should(Exit(0))
    71  
    72  				By("pushing a ruby app with a default buildpack sets buildpack to auto-detected (ruby)")
    73  				session = helpers.CustomCF(helpers.CFEnv{WorkingDirectory: dir},
    74  					PushCommandName, appName,
    75  					"-b", "default",
    76  				)
    77  				Eventually(session).Should(Say(`\-\s+buildpack:\s+staticfile_buildpack`))
    78  				Consistently(session).ShouldNot(Say(`\+\s+buildpack:`))
    79  				Eventually(session).Should(Say("Ruby Buildpack"))
    80  				Eventually(session).Should(Exit(0))
    81  
    82  				session = helpers.CF("app", appName)
    83  				Eventually(session).Should(Say(`buildpack:\s+ruby_buildpack`))
    84  				Eventually(session).Should(Exit(0))
    85  
    86  			})
    87  		})
    88  	})
    89  })