コード例 #1
0
			}
			fakeRunner.WhenRunning(
				cmdSpec,
				func(cmd *exec.Cmd) error {
					bytes, err := ioutil.ReadAll(cmd.Stdin)
					Expect(err).ToNot(HaveOccurred())

					Expect(string(bytes)).To(Equal("the-tar-content"))

					return nil
				},
			)

			err := container.StreamIn(garden.StreamInSpec{
				User:      "******",
				Path:      "/some/directory/dst",
				TarStream: bytes.NewBufferString("the-tar-content"),
			})
			Expect(err).ToNot(HaveOccurred())

			Expect(fakeRunner).To(HaveExecutedSerially(cmdSpec))
		})

		Context("when no user specified", func() {
			It("streams the input to tar as root", func() {
				cmdSpec := fake_command_runner.CommandSpec{
					Path: containerDir + "/bin/nstar",
					Args: []string{
						"12345",
						"root",
						"/some/directory/dst",