示例#1
0
					It("creates a container with the config's image and the session ID as the handle", func() {
						Ω(fakeWorkerClient.CreateContainerCallCount()).Should(Equal(1))
						createdIdentifier, spec := fakeWorkerClient.CreateContainerArgsForCall(0)
						Ω(createdIdentifier).Should(Equal(identifier))

						taskSpec := spec.(worker.TaskContainerSpec)
						Ω(taskSpec.Platform).Should(Equal("some-platform"))
						Ω(taskSpec.Tags).Should(ConsistOf("config", "step", "tags"))
						Ω(taskSpec.Image).Should(Equal("some-image"))
						Ω(taskSpec.Privileged).Should(BeFalse())

					})

					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)