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()
}
	"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")
Exemple #3
0
	)
	Ω(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)
Exemple #4
0
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))
Exemple #5
0
	"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