Exemplo n.º 1
0
			It("returns the error", func() {
				err := container.LimitBandwidth(limits)
				Expect(err).To(Equal(disaster))
			})
		})
	})

	Describe("Getting the current bandwidth limit", func() {
		limits := garden.BandwidthLimits{
			RateInBytesPerSecond:      128,
			BurstRateInBytesPerSecond: 256,
		}

		It("returns a zero value if no limits are set", func() {
			receivedLimits, err := container.CurrentBandwidthLimits()
			Expect(err).ToNot(HaveOccurred())
			Expect(receivedLimits).To(BeZero())
		})

		Context("when limits are set", func() {
			It("returns them", func() {
				err := container.LimitBandwidth(limits)
				Expect(err).ToNot(HaveOccurred())

				receivedLimits, err := container.CurrentBandwidthLimits()
				Expect(err).ToNot(HaveOccurred())
				Expect(receivedLimits).To(Equal(limits))
			})

			Context("when limits fail to be set", func() {