コード例 #1
0
ファイル: container_test.go プロジェクト: vito/warden-linux
					return warden.ContainerInfo{}, disaster
				}
			})

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

	Describe("StreamIn", func() {
		It("sends a stream in request", func() {
			reader, w := io.Pipe()
			fakeConnection.WhenStreamingIn = func(handle string, dst string) (io.WriteCloser, error) {
				Ω(dst).Should(Equal("to"))
				return w, nil
			}

			writer, err := container.StreamIn("to")
			Ω(err).ShouldNot(HaveOccurred())

			go func() {
				writer.Write([]byte("stuff"))
				writer.Close()
			}()

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