예제 #1
0
func (r *GardenRunner) Prepare() error {
	r.tmpdir = fmt.Sprintf("/tmp/garden-%d-%d", time.Now().UnixNano(), config.GinkgoConfig.ParallelNode)
	err := r.cmd("mkdir", r.tmpdir).Run()
	if err != nil {
		return err
	}

	if r.Remote == "" {
		compiled, err := cmdtest.Build("github.com/pivotal-cf-experimental/garden")
		if err != nil {
			return err
		}

		r.gardenBin = compiled
	} else {
		buildCmd := r.cmd("/vagrant/bin/integration/build")
		buildCmd.Stdout = os.Stdout
		buildCmd.Stderr = os.Stderr

		err = buildCmd.Run()
		if err != nil {
			return err
		}

		r.gardenBin = "/vagrant/bin/integration/out/garden"
	}

	r.DepotPath = filepath.Join(r.tmpdir, "containers")
	err = r.cmd("mkdir", "-m", "0755", r.DepotPath).Run()
	if err != nil {
		return err
	}

	r.SnapshotsPath = filepath.Join(r.tmpdir, "snapshots")
	return r.cmd("mkdir", r.SnapshotsPath).Run()
}
예제 #2
0
	"path"
	"syscall"
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/vito/cmdtest"
	. "github.com/vito/cmdtest/matchers"
)

var _ = Describe("Running wshd", func() {
	wshd := "../../root/linux/skeleton/bin/wshd"

	wsh := "../../root/linux/skeleton/bin/wsh"

	shmTest, err := cmdtest.Build("github.com/pivotal-cf-experimental/garden/integration/wshd/shm_test")
	if err != nil {
		panic(err)
	}

	var socketPath string
	var containerPath string
	var wshdCommand *exec.Cmd

	BeforeEach(func() {
		containerDir, err := ioutil.TempDir(os.TempDir(), "wshd-test-container")
		Expect(err).ToNot(HaveOccurred())

		containerPath = containerDir

		binDir := path.Join(containerDir, "bin")
예제 #3
0
파일: main_test.go 프로젝트: vito/gocart
	)
	Ω(err).ShouldNot(HaveOccurred())

	fakeUnlockedRepoWithRecursiveConflictingDependencies, err = filepath.Abs(
		path.Join(gocartDir, "fixtures", "fake_recursive_repo_with_conflicting_dependencies"),
	)
	Ω(err).ShouldNot(HaveOccurred())

	fakeUnlockedRepoWithTestDependencies, err = filepath.Abs(
		path.Join(gocartDir, "fixtures", "fake_repo_with_test_tag"),
	)
	Ω(err).ShouldNot(HaveOccurred())
})

var _ = Describe("install", func() {
	gocartPath, err := cmdtest.Build("github.com/vito/gocart")
	if err != nil {
		panic(err)
	}

	// TODO: move to cmdtest
	err = os.Chmod(gocartPath, 0755)
	if err != nil {
		panic(err)
	}

	var installCmd *exec.Cmd
	var gopath string

	teeToStdout := func(w io.Writer) io.Writer {
		return io.MultiWriter(w, os.Stdout)
예제 #4
0
파일: spiff_test.go 프로젝트: jbayer/spiff
package main

import (
	"io/ioutil"
	"os"

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

	"github.com/vito/cmdtest"
	. "github.com/vito/cmdtest/matchers"
)

var _ = Describe("Running spiff", func() {
	spiff, err := cmdtest.Build(".")
	if err != nil {
		panic(err)
	}

	Describe("merge", func() {
		var merge *cmdtest.Session

		Context("when given a bad file path", func() {
			BeforeEach(func() {
				merge, err = cmdtest.Start(spiff, "merge", "foo.yml")
				Expect(err).NotTo(HaveOccured())
			})

			It("says file not found", func() {
				Expect(merge).To(SayError("foo.yml: no such file or directory"))
				Expect(merge).To(ExitWith(1))
예제 #5
0
파일: boosh_test.go 프로젝트: mmb/boosh
	"os/exec"
	"time"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/vito/cmdtest"
	. "github.com/vito/cmdtest/matchers"
)

var _ = Describe("Boosh", func() {
	var booshPath string

	BeforeEach(func() {
		var err error

		booshPath, err = cmdtest.Build("github.com/vito/boosh")
		Ω(err).ShouldNot(HaveOccurred())
	})

	generating := func() *cmdtest.Session {
		session, err := cmdtest.Start(exec.Command(booshPath, "generate"))
		Ω(err).ShouldNot(HaveOccurred())

		return session
	}

	It("generates a correct deployment", func() {
		session := generating()

		session.Stdin.Write([]byte(`---
description: MicroBOSH