예제 #1
0
			})

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

	Describe("StreamIn", func() {
		It("sends a stream in request", func() {
			fakeConnection.StreamInStub = func(handle string, spec garden.StreamInSpec) error {
				Ω(spec.Path).Should(Equal("to"))
				Ω(spec.User).Should(Equal("frank"))

				content, err := ioutil.ReadAll(spec.TarStream)
				Ω(err).ShouldNot(HaveOccurred())
				Ω(string(content)).Should(Equal("stuff"))

				return nil
			}

			err := container.StreamIn(garden.StreamInSpec{
				User:      "******",
				Path:      "to",
				TarStream: bytes.NewBufferString("stuff"),
			})
			Ω(err).ShouldNot(HaveOccurred())
		})

		Context("when streaming in fails", func() {
			disaster := errors.New("oh no!")
예제 #2
0
파일: container_test.go 프로젝트: vito/gaol
			})

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

	Describe("StreamIn", func() {
		It("sends a stream in request", func() {
			fakeConnection.StreamInStub = func(handle string, dst string, reader io.Reader) error {
				Ω(dst).Should(Equal("to"))

				content, err := ioutil.ReadAll(reader)
				Ω(err).ShouldNot(HaveOccurred())
				Ω(string(content)).Should(Equal("stuff"))

				return nil
			}

			err := container.StreamIn("to", bytes.NewBufferString("stuff"))
			Ω(err).ShouldNot(HaveOccurred())
		})

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

			BeforeEach(func() {
				fakeConnection.StreamInReturns(
					disaster)