BeforeEach(func() { fakeBaggageclaimClient = new(bfakes.FakeClient) satisfyingWorker.VolumeManagerReturns(fakeBaggageclaimClient, true) }) Context("when the cache is already present", func() { var foundVolume *bfakes.FakeVolume BeforeEach(func() { foundVolume = new(bfakes.FakeVolume) foundVolume.HandleReturns("found-volume-handle") cacheIdentifier.FindOnReturns(foundVolume, true, nil) cacheIdentifier.ResourceVersionReturns(atc.Version{"some": "theversion"}) cacheIdentifier.ResourceHashReturns("hash") satisfyingWorker.NameReturns("myworker") foundVolume.ExpirationReturns(time.Hour, time.Now(), nil) }) It("does not error and returns a resource", func() { Expect(initErr).NotTo(HaveOccurred()) Expect(initResource).NotTo(BeNil()) }) It("chose the worker satisfying the resource type and tags", func() { Expect(workerClient.SatisfyingArgsForCall(0)).To(Equal(worker.WorkerSpec{ ResourceType: "type1", Tags: []string{"resource", "tags"}, })) })