It("sets the container handle", func() { Expect(container.Handle()).To(Equal("some-handle")) }) It("sets the container subvolume path", func() { Expect(container.RootFSPath()).To(Equal("some-volume-path")) }) It("sets the container grace time", func() { Expect(container.GraceTime()).To(Equal(1 * time.Second)) }) Describe("Starting", func() { It("should setup IPTables", func() { err := container.Start() Expect(err).ToNot(HaveOccurred()) Expect(fakeIPTablesManager.ContainerSetupCallCount()).To(Equal(1)) id, bridgeIface, ip, network := fakeIPTablesManager.ContainerSetupArgsForCall(0) Expect(id).To(Equal("some-id")) Expect(bridgeIface).To(Equal("some-bridge")) Expect(err).ToNot(HaveOccurred()) Expect(ip).To(Equal(containerResources.Network.IP)) Expect(network).To(Equal(containerResources.Network.Subnet)) }) Context("when IPTables setup fails", func() { JustBeforeEach(func() { fakeIPTablesManager.ContainerSetupReturns(errors.New("oh yes!")) })
It("sets the container handle", func() { Expect(container.Handle()).To(Equal("some-handle")) }) It("sets the container subvolume path", func() { Expect(container.RootFSPath()).To(Equal("some-volume-path")) }) It("sets the container grace time", func() { Expect(container.GraceTime()).To(Equal(1 * time.Second)) }) Describe("Starting", func() { It("executes the container's start.sh with the correct environment", func() { err := container.Start() Expect(err).ToNot(HaveOccurred()) Expect(fakeRunner).To(HaveExecutedSerially( fake_command_runner.CommandSpec{ Path: containerDir + "/start.sh", Env: []string{ "id=some-id", "PATH=" + os.Getenv("PATH"), }, }, )) }) It("changes the container's state to active", func() { Expect(container.State()).To(Equal(linux_backend.StateBorn))
ByteHard: 24, } bandwidthLimits := garden.BandwidthLimits{ RateInBytesPerSecond: 1, BurstRateInBytesPerSecond: 2, } cpuLimits := garden.CPULimits{ LimitInShares: 1, } JustBeforeEach(func() { var err error err = container.Start() Expect(err).ToNot(HaveOccurred()) _, _, err = container.NetIn(1, 2) Expect(err).ToNot(HaveOccurred()) _, _, err = container.NetIn(3, 4) Expect(err).ToNot(HaveOccurred()) container.NetOut(netOutRule1) container.NetOut(netOutRule2) p1 := new(wfakes.FakeProcess) p1.IDReturns("1") p2 := new(wfakes.FakeProcess)