Example #1
0
			})

			It("returns the error", func() {
				_, err := container.CurrentDiskLimits()
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Describe("CurrentMemoryLimits", func() {
		It("gets the current limits", func() {
			limitsToReturn := garden.MemoryLimits{
				LimitInBytes: 1,
			}

			fakeConnection.CurrentMemoryLimitsReturns(limitsToReturn, nil)

			limits, err := container.CurrentMemoryLimits()
			Ω(err).ShouldNot(HaveOccurred())

			Ω(limits).Should(Equal(limitsToReturn))
		})

		Context("when the request fails", func() {
			disaster := errors.New("oh no!")

			BeforeEach(func() {
				fakeConnection.CurrentMemoryLimitsReturns(garden.MemoryLimits{}, disaster)
			})

			It("returns the error", func() {
	Describe("CurrentMemoryLimits", func() {
		handle := "suitcase"

		limits := garden.MemoryLimits{
			LimitInBytes: 234,
		}

		var gotLimits garden.MemoryLimits

		itRetries(func() error {
			var err error
			gotLimits, err = conn.CurrentMemoryLimits(handle)
			return err
		}, func(err error) {
			innerConnection.CurrentMemoryLimitsReturns(limits, err)
		}, func() int {
			return innerConnection.CurrentMemoryLimitsCallCount()
		}, func() {
			It("calls through to garden", func() {
				Ω(innerConnection.CurrentMemoryLimitsCallCount()).Should(Equal(1))

				calledHandle := innerConnection.CurrentMemoryLimitsArgsForCall(0)
				Ω(calledHandle).Should(Equal(handle))
			})

			It("returns the limits", func() {
				Ω(gotLimits).Should(Equal(limits))
			})
		})
	})