Esempio n. 1
0
		fakeDepot.LookupStub = func(_ lager.Logger, handle string) (string, error) {
			return "/path/to/" + handle, nil
		}
	})

	Describe("Create", func() {
		It("should ask the depot to create a container", func() {
			var returnedBundle *goci.Bndl
			fakeBundler.BundleStub = func(spec gardener.DesiredContainerSpec) *goci.Bndl {
				returnedBundle = goci.Bundle().WithRootFS(spec.NetworkPath)
				return returnedBundle
			}

			containerizer.Create(logger, gardener.DesiredContainerSpec{
				Handle: "exuberant!",
			})

			Expect(fakeDepot.CreateCallCount()).To(Equal(1))

			_, handle, bundle := fakeDepot.CreateArgsForCall(0)
			Expect(handle).To(Equal("exuberant!"))
			Expect(bundle).To(Equal(returnedBundle))
		})

		Context("when creating the depot directory fails", func() {
			It("returns an error", func() {
				fakeDepot.CreateReturns(errors.New("blam"))
				Expect(containerizer.Create(logger, gardener.DesiredContainerSpec{
					Handle: "exuberant!",
				})).NotTo(Succeed())
Esempio n. 2
0
	var (
		fakeRepo *fakes.FakeRepo

		czr *rundmc.Containerizer
	)

	BeforeEach(func() {
		fakeRepo = new(fakes.FakeRepo)
		czr = &rundmc.Containerizer{
			Repo: fakeRepo,
		}
	})

	It("delegates creation to the repo", func() {
		spec := gardener.DesiredContainerSpec{Handle: "foo"}
		Expect(czr.Create(spec)).To(Succeed())

		Expect(fakeRepo.CreateCallCount()).To(Equal(1))
		Expect(fakeRepo.CreateArgsForCall(0)).To(Equal(spec))
	})

	Context("when the container exists", func() {
		It("delegates running to the repo", func() {
			anActualContainer := new(fakes.FakeActualContainer)
			fakeRepo.LookupReturns(anActualContainer, nil)

			stdout := gbytes.NewBuffer()
			czr.Run(
				"fishfinger",
				garden.ProcessSpec{Path: "foo"},
				garden.ProcessIO{Stdout: stdout},
Esempio n. 3
0
package rundmc_test

import (
	"github.com/cloudfoundry-incubator/guardian/gardener"
	"github.com/cloudfoundry-incubator/guardian/rundmc"
	. "github.com/onsi/ginkgo"
)

var _ = Describe("RunDMC Integration", func() {
	XIt("runs a process in a container", func() {
		containerizer := rundmc.Containerizer{}

		containerizer.Create(gardener.DesiredContainerSpec{
			Handle: "the-handle",
		})
	})
})