Пример #1
0
	Describe("WithCapabilities", func() {
		It("adds capabilities to the bundle", func() {
			returnedBundle := initialBundle.WithCapabilities("growtulips", "waterspuds")
			Expect(returnedBundle.Capabilities()).To(ContainElement("growtulips"))
			Expect(returnedBundle.Capabilities()).To(ContainElement("waterspuds"))
		})

		It("does not modify the initial bundle", func() {
			returnedBundle := initialBundle.WithCapabilities("growtulips", "waterspuds")
			Expect(returnedBundle).NotTo(Equal(initialBundle))
		})
	})

	Describe("WithProcess", func() {
		It("adds the process to the bundle", func() {
			returnedBundle := initialBundle.WithProcess(goci.Process("echo", "foo"))
			Expect(returnedBundle.Process()).To(Equal(specs.Process{Args: []string{"echo", "foo"}}))
		})

		It("sets the CWD to / by default", func() {
			returnedBundle := initialBundle.WithProcess(goci.Process("echo", "foo"))
			Expect(returnedBundle.Process()).To(Equal(specs.Process{Args: []string{"echo", "foo"}}))
		})

		It("does not modify the initial bundle", func() {
			returnedBundle := initialBundle.WithProcess(goci.Process("echo", "foo"))
			Expect(returnedBundle).NotTo(Equal(initialBundle))
		})
	})

	Describe("WithRootFS", func() {
Пример #2
0
func (r Env) Apply(bndl goci.Bndl, spec gardener.DesiredContainerSpec) goci.Bndl {
	process := bndl.Process()
	process.Env = spec.Env
	return bndl.WithProcess(process)
}