Ejemplo n.º 1
0
func createKey() (string, string) {
	keyName := fmt.Sprintf("deiskey-%v", rand.Intn(1000))
	sshHome := path.Join(settings.TestHome, ".ssh")
	os.MkdirAll(sshHome, 0777)
	keyPath := path.Join(sshHome, keyName)
	if _, err := os.Stat(keyPath); os.IsNotExist(err) {
		_, err := cmd.Execute("ssh-keygen -q -t rsa -b 4096 -C %s -f %s -N ''", keyName, keyPath)
		Expect(err).NotTo(HaveOccurred())
	}
	os.Chmod(keyPath, 0600)
	return keyName, keyPath
}
Ejemplo n.º 2
0
		})

		AfterEach(func() {
			auth.Cancel(user)
		})

		Context("who has added their public key", func() {

			BeforeEach(func() {
				_, keyPath = keys.Add(user)
			})

			Context("and who has a local git repo containing buildpack source code", func() {

				BeforeEach(func() {
					output, err := cmd.Execute(`git clone https://github.com/deis/example-go.git`)
					Expect(err).NotTo(HaveOccurred(), output)
				})

				Context("and has run `deis apps:create` from within that repo", func() {

					var app model.App

					BeforeEach(func() {
						os.Chdir("example-go")
						app = apps.Create(user)
					})

					AfterEach(func() {
						apps.Destroy(user, app)
					})
Ejemplo n.º 3
0
import (
	"github.com/deis/workflow-e2e/tests/cmd"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("deis help", func() {

	usageMsg := "Usage: deis <command> [<args>...]"
	optionFlagsMsg := "Option flags::"
	noMatchMsg := "Found no matching command, try 'deis help'"

	Specify("the --help flag causes the help message to be printed", func() {
		output, err := cmd.Execute("deis --help")
		Expect(err).NotTo(HaveOccurred())
		Expect(output).To(ContainSubstring(usageMsg))
		Expect(output).To(ContainSubstring(optionFlagsMsg))
	})

	Specify("the -h flag causes the help message to be printed", func() {
		output, err := cmd.Execute("deis -h")
		Expect(err).NotTo(HaveOccurred())
		Expect(output).To(ContainSubstring(usageMsg))
		Expect(output).To(ContainSubstring(optionFlagsMsg))
	})

	Specify("the help subcommand causes the help message to be printed", func() {
		output, err := cmd.Execute("deis help")
		Expect(err).NotTo(HaveOccurred())
Ejemplo n.º 4
0
		AfterEach(func() {
			auth.Cancel(user)
		})

		Context("who has added their public key", func() {

			BeforeEach(func() {
				_, keyPath = keys.Add(user)
			})

			DescribeTable("can deploy an example buildpack app",
				func(url, buildpack, banner string) {

					var app model.App

					output, err := cmd.Execute(`git clone %s`, url)
					Expect(err).NotTo(HaveOccurred(), output)
					// infer app directory from URL
					splits := strings.Split(url, "/")
					dir := strings.TrimSuffix(splits[len(splits)-1], ".git")
					os.Chdir(dir)
					// create with custom buildpack if needed
					var args []string
					if buildpack != "" {
						args = append(args, fmt.Sprintf("--buildpack %s", buildpack))
					}
					app = apps.Create(user, args...)
					defer apps.Destroy(user, app)
					git.Push(user, keyPath, app, banner)

				},
Ejemplo n.º 5
0
package tests

import (
	"github.com/deis/workflow-e2e/tests/cmd"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("deis version", func() {

	semVerRegExp := `^v?(?:[0-9]+\.){2}[0-9]+`
	gitSHARegExp := `[0-9a-f]{7}`

	Specify("the version subcommand causes version information to be printed", func() {
		output, err := cmd.Execute("deis --version")
		Expect(output).To(MatchRegexp(`%s(-dev)?(-%s)?\n`, semVerRegExp, gitSHARegExp))
		Expect(err).NotTo(HaveOccurred())
	})

})
Ejemplo n.º 6
0
					Expect(err).NotTo(HaveOccurred())
					Eventually(sess).Should(Exit(1))
					// Transer back or else cleanup will fail.
					sess, err = cmd.Start("deis apps:transfer --app=%s %s", &otherUser, app.Name, user.Username)
					Expect(err).NotTo(HaveOccurred())
					Eventually(sess).Should(Exit(0))
				})

			})

		})

		Context("who has a local git repo containing source code", func() {

			BeforeEach(func() {
				output, err := cmd.Execute(`git clone https://github.com/deis/example-go.git`)
				Expect(err).NotTo(HaveOccurred(), output)
			})

			Specify("that user can create an app with a git remote", func() {
				os.Chdir("example-go")
				app := apps.Create(user)
				apps.Destroy(user, app)
			})

		})

		Context("who owns an existing app that has already been deployed", func() {

			uuidRegExp := `[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}`
			procsRegexp := `(%s-v\d+-[\w-]+) up \(v\d+\)`