It("obtains the current limits", func() { effectiveLimits := garden.MemoryLimits{2048} fakeContainer.CurrentMemoryLimitsReturns(effectiveLimits, nil) limits, err := container.CurrentMemoryLimits() Ω(err).ShouldNot(HaveOccurred()) Ω(limits).ShouldNot(BeZero()) Ω(limits).Should(Equal(effectiveLimits)) }) It("does not change the memory limit", func() { _, err := container.CurrentMemoryLimits() Ω(err).ShouldNot(HaveOccurred()) Ω(fakeContainer.LimitMemoryCallCount()).Should(BeZero()) }) itFailsWhenTheContainerIsNotFound(func() error { _, err := container.CurrentMemoryLimits() return err }) Context("when getting the current memory limits fails", func() { BeforeEach(func() { fakeContainer.CurrentMemoryLimitsReturns(garden.MemoryLimits{}, errors.New("oh no!")) }) It("fails", func() { _, err := container.CurrentMemoryLimits() Ω(err).Should(HaveOccurred())