Пример #1
0
				err := container.LimitMemory(garden.MemoryLimits{
					LimitInBytes: 102400,
				})

				Expect(err).To(MatchError("banana"))
			})
		})
	})

	Describe("Getting the current memory limit", func() {
		It("returns the limited memory", func() {
			fakeCgroups.WhenGetting("memory", "memory.limit_in_bytes", func() (string, error) {
				return "18446744073709551615", nil
			})

			limits, err := container.CurrentMemoryLimits()
			Expect(err).ToNot(HaveOccurred())
			Expect(limits.LimitInBytes).To(Equal(uint64(math.MaxUint64)))
		})

		Context("when getting the limit fails", func() {
			It("returns the error", func() {
				disaster := errors.New("oh no!")
				fakeCgroups.WhenGetting("memory", "memory.limit_in_bytes", func() (string, error) {
					return "", disaster
				})

				_, err := container.CurrentMemoryLimits()
				Expect(err).To(Equal(disaster))
			})
		})