コード例 #1
0
ファイル: container_test.go プロジェクト: vito/warden-linux
			})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.LimitedMemory("some-handle")).Should(ContainElement(
				warden.MemoryLimits{
					LimitInBytes: 1,
				},
			))
		})

		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() {
				err := container.LimitMemory(warden.MemoryLimits{})
				Ω(err).Should(Equal(disaster))
			})
		})
	})

	Describe("CurrentBandwidthLimits", func() {
		It("sends an empty limit request and returns its response", func() {
			limitsToReturn := warden.BandwidthLimits{
				RateInBytesPerSecond:      1,
				BurstRateInBytesPerSecond: 2,