It("returns the error", func() { err := container.LimitBandwidth(garden.BandwidthLimits{}) Ω(err).Should(Equal(disaster)) }) }) }) Describe("LimitCPU", func() { It("sends a limit cpu request", func() { err := container.LimitCPU(garden.CPULimits{ LimitInShares: 1, }) Ω(err).ShouldNot(HaveOccurred()) handle, limits := fakeConnection.LimitCPUArgsForCall(0) Ω(handle).Should(Equal("some-handle")) Ω(limits).Should(Equal(garden.CPULimits{LimitInShares: 1})) }) Context("when the request fails", func() { disaster := errors.New("oh no!") BeforeEach(func() { fakeConnection.LimitCPUReturns(garden.CPULimits{}, disaster) }) It("returns the error", func() { err := container.LimitCPU(garden.CPULimits{}) Ω(err).Should(Equal(disaster)) })
var gotLimits garden.CPULimits itRetries(func() error { var err error gotLimits, err = conn.LimitCPU(handle, limits) return err }, func(err error) { innerConnection.LimitCPUReturns(limits, err) }, func() int { return innerConnection.LimitCPUCallCount() }, func() { It("calls through to garden", func() { Ω(innerConnection.LimitCPUCallCount()).Should(Equal(1)) calledHandle, calledLimits := innerConnection.LimitCPUArgsForCall(0) Ω(calledHandle).Should(Equal(handle)) Ω(calledLimits).Should(Equal(limits)) }) It("returns the limits", func() { Ω(gotLimits).Should(Equal(limits)) }) }) }) Describe("LimitDisk", func() { handle := "suitcase" limits := garden.DiskLimits{ ByteHard: 234,