err := container.LimitCPU(garden.CPULimits{ LimitInShares: 512, }) Expect(err).To(Equal(disaster)) }) }) }) Describe("Getting the current CPU limits", func() { It("returns the CPU limits", func() { fakeCgroups.WhenGetting("cpu", "cpu.shares", func() (string, error) { return "512", nil }) limits, err := container.CurrentCPULimits() Expect(err).ToNot(HaveOccurred()) Expect(limits.LimitInShares).To(Equal(uint64(512))) }) Context("when getting the limit fails", func() { It("returns the error", func() { disaster := errors.New("oh no!") fakeCgroups.WhenGetting("cpu", "cpu.shares", func() (string, error) { return "", disaster }) _, err := container.CurrentCPULimits() Expect(err).To(Equal(disaster)) }) })