Beispiel #1
0
				fakeConnection.WhenStreamingOut = func(handle string, src string) (io.Reader, error) {
					return nil, disaster
				}
			})

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

	Describe("LimitBandwidth", func() {
		It("sends a limit bandwidth request", func() {
			err := container.LimitBandwidth(warden.BandwidthLimits{
				RateInBytesPerSecond: 1,
			})
			Ω(err).ShouldNot(HaveOccurred())

			Ω(fakeConnection.LimitedBandwidth("some-handle")).Should(ContainElement(
				warden.BandwidthLimits{
					RateInBytesPerSecond: 1,
				},
			))
		})

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

			BeforeEach(func() {
				fakeConnection.WhenLimitingBandwidth = func(handle string, limits warden.BandwidthLimits) (warden.BandwidthLimits, error) {