github.com/deiscc/workflow-e2e@v0.0.0-20181208071258-117299af888f/tests/buildprocfile_test.go (about)

     1  package tests
     2  
     3  import (
     4  	"github.com/deiscc/workflow-e2e/tests/cmd"
     5  	"github.com/deiscc/workflow-e2e/tests/cmd/apps"
     6  	"github.com/deiscc/workflow-e2e/tests/cmd/auth"
     7  	"github.com/deiscc/workflow-e2e/tests/model"
     8  	"github.com/deiscc/workflow-e2e/tests/settings"
     9  
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  	. "github.com/onsi/gomega/gbytes"
    13  	. "github.com/onsi/gomega/gexec"
    14  )
    15  
    16  var _ = Describe("deis builds procfile", func() {
    17  
    18  	Context("with an existing user", func() {
    19  
    20  		var user model.User
    21  
    22  		BeforeEach(func() {
    23  			user = auth.RegisterAndLogin()
    24  		})
    25  
    26  		AfterEach(func() {
    27  			auth.Cancel(user)
    28  		})
    29  
    30  		Context("who owns an existing app that has not been deployed", func() {
    31  
    32  			var app model.App
    33  
    34  			BeforeEach(func() {
    35  				app = apps.Create(user, "--no-remote")
    36  			})
    37  
    38  			AfterEach(func() {
    39  				apps.Destroy(user, app)
    40  			})
    41  			Specify("that user can create a new build of that app with a different procfile", func() {
    42  				Image := "smothiki/exampleapp:latest"
    43  				procfile := "web: /bin/boot"
    44  				sess, err := cmd.Start("deis pull %s --app=%s ", &user, Image, app.Name)
    45  				Expect(err).NotTo(HaveOccurred())
    46  				Eventually(sess).Should(Say("Creating build..."))
    47  				Eventually(sess, settings.MaxEventuallyTimeout).Should(Exit(0))
    48  				sess, err = cmd.Start("deis builds:create %s -a %s --procfile \"%s\"", &user, Image, app.Name, procfile)
    49  				Expect(err).NotTo(HaveOccurred())
    50  				Eventually(sess).Should(Say("Creating build..."))
    51  				Eventually(sess, settings.MaxEventuallyTimeout).Should(Exit(0))
    52  				sess, err = cmd.Start("deis ps:scale web=1 -a %s", &user, app.Name)
    53  				Expect(err).NotTo(HaveOccurred())
    54  				Eventually(sess, settings.MaxEventuallyTimeout).Should(Say("Scaling processes... but first,"))
    55  				Eventually(sess, settings.MaxEventuallyTimeout).Should(Say(`done in \d+s`))
    56  				Eventually(sess).Should(Say("=== %s Processes", app.Name))
    57  				Eventually(sess).Should(Say(`(--- [\w]+)`))
    58  				Eventually(sess).Should(Say(`(%s-[\w-]+) up \(v\d+\)`, app.Name))
    59  				Eventually(sess).Should(Say(`(--- [\w]+)`))
    60  				Eventually(sess).Should(Say(`(%s-[\w-]+) up \(v\d+\)`, app.Name))
    61  				Eventually(sess, settings.MaxEventuallyTimeout).Should(Exit(0))
    62  			})
    63  
    64  		})
    65  
    66  	})
    67  
    68  })