github.com/deis/workflow-e2e@v2.12.2-0.20180227201524-4105be7001fe+incompatible/tests/dockerfiles_test.go (about)

     1  package tests
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"strings"
     7  
     8  	"github.com/deis/workflow-e2e/tests/cmd"
     9  	"github.com/deis/workflow-e2e/tests/cmd/apps"
    10  	"github.com/deis/workflow-e2e/tests/cmd/auth"
    11  	"github.com/deis/workflow-e2e/tests/cmd/git"
    12  	"github.com/deis/workflow-e2e/tests/cmd/keys"
    13  	"github.com/deis/workflow-e2e/tests/model"
    14  
    15  	. "github.com/onsi/ginkgo"
    16  	. "github.com/onsi/ginkgo/extensions/table"
    17  	. "github.com/onsi/gomega"
    18  )
    19  
    20  var _ = Describe("all dockerfile apps", func() {
    21  
    22  	Context("with an existing user", func() {
    23  
    24  		var user model.User
    25  		var keyPath string
    26  
    27  		BeforeEach(func() {
    28  			user = auth.RegisterAndLogin()
    29  		})
    30  
    31  		AfterEach(func() {
    32  			auth.Cancel(user)
    33  		})
    34  
    35  		Context("who has added their public key", func() {
    36  
    37  			BeforeEach(func() {
    38  				_, keyPath = keys.Add(user)
    39  			})
    40  
    41  			DescribeTable("can deploy an example dockerfile app",
    42  				func(url, buildpack, banner, proctype string) {
    43  
    44  					var app model.App
    45  
    46  					output, err := cmd.Execute(`git clone %s`, url)
    47  					Expect(err).NotTo(HaveOccurred(), output)
    48  					// infer app directory from URL
    49  					splits := strings.Split(url, "/")
    50  					dir := strings.TrimSuffix(splits[len(splits)-1], ".git")
    51  					os.Chdir(dir)
    52  					// creeate with custom buildpack if needed
    53  					var args []string
    54  					if buildpack != "" {
    55  						args = append(args, fmt.Sprintf("--buildpack %s", buildpack))
    56  					}
    57  					app = apps.Create(user, args...)
    58  					defer apps.Destroy(user, app)
    59  					git.Push(user, keyPath, app, banner)
    60  					_ = listProcs(user, app, proctype)
    61  
    62  				},
    63  
    64  				Entry("HTTP", "https://github.com/deis/example-dockerfile-http.git", "",
    65  					"Powered by Deis", ""),
    66  				Entry("Python", "https://github.com/deis/example-dockerfile-python.git", "",
    67  					"Powered by Deis", ""),
    68  				Entry("HTTP-Web", "https://github.com/deis/example-dockerfile-procfile-http.git", "",
    69  					"Powered by Deis", "web"),
    70  			)
    71  
    72  		})
    73  
    74  	})
    75  
    76  })