コード例 #1
0
ファイル: put_step_test.go プロジェクト: pcfdev-forks/atc
		factory = NewGardenFactory(fakeWorkerClient, fakeTracker)

		stdoutBuf = gbytes.NewBuffer()
		stderrBuf = gbytes.NewBuffer()
	})

	Describe("Put", func() {
		var (
			putDelegate    *fakes.FakePutDelegate
			resourceConfig atc.ResourceConfig
			params         atc.Params
			tags           []string
			resourceTypes  atc.ResourceTypes

			inStep *fakes.FakeStep
			repo   *SourceRepository

			fakeSource        *fakes.FakeArtifactSource
			fakeOtherSource   *fakes.FakeArtifactSource
			fakeMountedSource *fakes.FakeArtifactSource

			step    Step
			process ifrit.Process
		)

		BeforeEach(func() {
			putDelegate = new(fakes.FakePutDelegate)
			putDelegate.StdoutReturns(stdoutBuf)
			putDelegate.StderrReturns(stderrBuf)

			resourceConfig = atc.ResourceConfig{
コード例 #2
0
ファイル: config_source_test.go プロジェクト: utako/atc
		JustBeforeEach(func() {
			fetchedConfig, fetchErr = configSource.FetchConfig(repo)
		})

		Context("when the path does not indicate an artifact source", func() {
			BeforeEach(func() {
				configSource.Path = "foo-bar.yml"
			})

			It("returns an error", func() {
				Ω(fetchErr).Should(Equal(UnspecifiedArtifactSourceError{"foo-bar.yml"}))
			})
		})

		Context("when the file's artifact source can be found in the repository", func() {
			var fakeArtifactSource *fakes.FakeArtifactSource

			BeforeEach(func() {
				fakeArtifactSource = new(fakes.FakeArtifactSource)
				repo.RegisterSource("some", fakeArtifactSource)
			})

			Context("when the artifact source provides a proper file", func() {
				var streamedOut *gbytes.Buffer

				BeforeEach(func() {
					marshalled, err := yaml.Marshal(someConfig)
					Ω(err).ShouldNot(HaveOccurred())

					streamedOut = gbytes.BufferWithBytes(marshalled)
					fakeArtifactSource.StreamFileReturns(streamedOut, nil)
コード例 #3
0
ファイル: task_step_test.go プロジェクト: utako/atc
							Ω(fakeContainer.RunCallCount()).Should(Equal(1))

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

					Context("when the configuration specifies paths for inputs", func() {
						var inputSource *fakes.FakeArtifactSource
						var otherInputSource *fakes.FakeArtifactSource

						BeforeEach(func() {
							inputSource = new(fakes.FakeArtifactSource)
							otherInputSource = new(fakes.FakeArtifactSource)

							configSource.FetchConfigReturns(atc.TaskConfig{
								Image:  "some-image",
								Params: map[string]string{"SOME": "params"},
								Run: atc.TaskRunConfig{
									Path: "ls",
									Args: []string{"some", "args"},
								},
								Inputs: []atc.TaskInputConfig{
									{Name: "some-input", Path: "some-input-configured-path"},
コード例 #4
0
ファイル: source_repository_test.go プロジェクト: ACPK/atc
	var (
		repo *SourceRepository
	)

	BeforeEach(func() {
		repo = NewSourceRepository()
	})

	It("initially does not contain any sources", func() {
		source, found := repo.SourceFor("first-source")
		Expect(source).To(BeNil())
		Expect(found).To(BeFalse())
	})

	Context("when a source is registered", func() {
		var firstSource *fakes.FakeArtifactSource

		BeforeEach(func() {
			firstSource = new(fakes.FakeArtifactSource)
			repo.RegisterSource("first-source", firstSource)
		})

		It("can be converted to a map", func() {
			Expect(repo.AsMap()).To(Equal(map[SourceName]ArtifactSource{
				"first-source": firstSource,
			}))
		})

		Describe("SourceFor", func() {
			It("yields the source by the given name", func() {
				source, found := repo.SourceFor("first-source")
コード例 #5
0
ファイル: put_step_test.go プロジェクト: utako/atc
		fakeWorkerClient = new(wfakes.FakeClient)

		factory = NewGardenFactory(fakeWorkerClient, fakeTracker, func() string { return "" })

		stdoutBuf = gbytes.NewBuffer()
		stderrBuf = gbytes.NewBuffer()
	})

	Describe("Put", func() {
		var (
			putDelegate    *fakes.FakePutDelegate
			resourceConfig atc.ResourceConfig
			params         atc.Params
			tags           []string

			inStep *fakes.FakeStep
			repo   *SourceRepository

			fakeSource *fakes.FakeArtifactSource

			step    Step
			process ifrit.Process
		)

		BeforeEach(func() {
			putDelegate = new(fakes.FakePutDelegate)
			putDelegate.StdoutReturns(stdoutBuf)
			putDelegate.StderrReturns(stderrBuf)

			resourceConfig = atc.ResourceConfig{
				Name:   "some-resource",
				Type:   "some-resource-type",
コード例 #6
0
ファイル: config_source_test.go プロジェクト: ACPK/atc
		JustBeforeEach(func() {
			fetchedConfig, fetchErr = configSource.FetchConfig(repo)
		})

		Context("when the path does not indicate an artifact source", func() {
			BeforeEach(func() {
				configSource.Path = "foo-bar.yml"
			})

			It("returns an error", func() {
				Expect(fetchErr).To(Equal(UnspecifiedArtifactSourceError{"foo-bar.yml"}))
			})
		})

		Context("when the file's artifact source can be found in the repository", func() {
			var fakeArtifactSource *fakes.FakeArtifactSource

			BeforeEach(func() {
				fakeArtifactSource = new(fakes.FakeArtifactSource)
				repo.RegisterSource("some", fakeArtifactSource)
			})

			Context("when the artifact source provides a proper file", func() {
				var streamedOut *gbytes.Buffer

				BeforeEach(func() {
					marshalled, err := yaml.Marshal(someConfig)
					Expect(err).NotTo(HaveOccurred())

					streamedOut = gbytes.BufferWithBytes(marshalled)
					fakeArtifactSource.StreamFileReturns(streamedOut, nil)