コード例 #1
0
					"/some/directory",
					"dst",
				},
			}
			fakeRunner.WhenRunning(
				cmdSpec,
				func(cmd *exec.Cmd) error {
					_, err := cmd.Stdout.Write([]byte("the-compressed-content"))
					Expect(err).ToNot(HaveOccurred())

					return nil
				},
			)

			reader, err := container.StreamOut(garden.StreamOutSpec{
				User: "******",
				Path: "/some/directory/dst",
			})
			Expect(err).ToNot(HaveOccurred())

			bytes, err := ioutil.ReadAll(reader)
			Expect(err).ToNot(HaveOccurred())
			Expect(string(bytes)).To(Equal("the-compressed-content"))

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

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