Exemplo n.º 1
0
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Describe("CurrentMemoryLimits", func() {
		It("sends an empty limit request and returns its response", func() {
			limitsToReturn := warden.MemoryLimits{
				LimitInBytes: 1,
			}

			fakeConnection.WhenLimitingMemory = func(handle string, limits warden.MemoryLimits) (warden.MemoryLimits, error) {
				return 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.WhenLimitingMemory = func(handle string, limits warden.MemoryLimits) (warden.MemoryLimits, error) {
					return warden.MemoryLimits{}, disaster
				}
			})

			It("returns the error", func() {