Esempio n. 1
0
			BeforeEach(func() {
				fakeResource = new(rfakes.FakeResource)
				fakeCache = new(rfakes.FakeCache)
				fakeTracker.InitWithCacheReturns(fakeResource, fakeCache, nil)

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

				fakeResource.GetReturns(fakeVersionedSource)
			})

			It("initializes the resource with the correct type and session id, making sure that it is not ephemeral", func() {
				Expect(fakeTracker.InitWithCacheCallCount()).To(Equal(1))

				_, sm, sid, typ, tags, cacheID := fakeTracker.InitWithCacheArgsForCall(0)
				Expect(sm).To(Equal(stepMetadata))
				Expect(sid).To(Equal(resource.Session{
					ID:        identifier,
					Ephemeral: false,
				}))
				Expect(typ).To(Equal(resource.ResourceType("some-resource-type")))
				Expect(tags).To(ConsistOf("some", "tags"))
				Expect(cacheID).To(Equal(resource.ResourceCacheIdentifier{
					Type:    "some-resource-type",
					Source:  resourceConfig.Source,
					Params:  params,
					Version: version,
				}))
			})
Esempio n. 2
0
			BeforeEach(func() {
				fakeResource = new(rfakes.FakeResource)
				fakeCache = new(rfakes.FakeCache)
				fakeTracker.InitWithCacheReturns(fakeResource, fakeCache, nil)

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

				fakeResource.GetReturns(fakeVersionedSource)
			})

			It("created a cached resource", func() {
				Expect(fakeTracker.InitWithCacheCallCount()).To(Equal(1))
				_, sm, sid, typ, tags, cacheID, actualResourceTypes, delegate := fakeTracker.InitWithCacheArgsForCall(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.ContainerTypeGet,
						StepName:         "some-step",
						WorkingDirectory: "/tmp/build/get",
					},
					Ephemeral: false,
				}))
				Expect(typ).To(Equal(resource.ResourceType("some-resource-type")))