Exemplo n.º 1
0
		Context("when the tracker can initialize the resource", func() {
			var (
				fakeResource        *rfakes.FakeResource
				fakeVersionedSource *rfakes.FakeVersionedSource
			)

			BeforeEach(func() {
				fakeResource = new(rfakes.FakeResource)
				fakeTracker.InitWithSourcesReturns(fakeResource, []string{"some-source", "some-other-source"}, nil)

				fakeVersionedSource = new(rfakes.FakeVersionedSource)
				fakeVersionedSource.VersionReturns(atc.Version{"some": "version"})
				fakeVersionedSource.MetadataReturns([]atc.MetadataField{{"some", "metadata"}})

				fakeResource.PutReturns(fakeVersionedSource)
			})

			It("initializes the resource with the correct type, session, and sources", func() {
				Expect(fakeTracker.InitWithSourcesCallCount()).To(Equal(1))

				_, sm, sid, typ, tags, sources, actualResourceTypes, delegate := fakeTracker.InitWithSourcesArgsForCall(0)
				Expect(sm).To(Equal(stepMetadata))
				Expect(sid).To(Equal(resource.Session{
					ID: worker.Identifier{
						ResourceID: 1234,
						Stage:      db.ContainerStageRun,
					},
					Metadata: worker.Metadata{
						PipelineName:     "some-pipeline",
						Type:             db.ContainerTypePut,