示例#1
0
					It("ensures artifacts root exists by streaming in an empty payload", func() {
						Ω(fakeContainer.StreamInCallCount()).Should(Equal(1))

						spec := fakeContainer.StreamInArgsForCall(0)
						Ω(spec.Path).Should(Equal("/tmp/build/a-random-guid"))
						Ω(spec.User).Should(Equal("")) // use default

						tarReader := tar.NewReader(spec.TarStream)

						_, err := tarReader.Next()
						Ω(err).Should(Equal(io.EOF))
					})

					It("runs a process with the config's path and args, in the specified build directory", func() {
						Ω(fakeContainer.RunCallCount()).Should(Equal(1))

						spec, _ := fakeContainer.RunArgsForCall(0)
						Ω(spec.Path).Should(Equal("ls"))
						Ω(spec.Args).Should(Equal([]string{"some", "args"}))
						Ω(spec.Env).Should(Equal([]string{"SOME=params"}))
						Ω(spec.Dir).Should(Equal("/tmp/build/a-random-guid"))
						Ω(spec.User).Should(Equal("root"))
						Ω(spec.TTY).Should(Equal(&garden.TTYSpec{}))
					})

					It("directs the process's stdout/stderr to the io config", func() {
						Ω(fakeContainer.RunCallCount()).Should(Equal(1))

						_, io := fakeContainer.RunArgsForCall(0)
						Ω(io.Stdout).Should(Equal(stdoutBuf))