コード例 #1
0
			}

			expectedSetVolumeTTLArgs := []setVolumeTTLArgs{
				{
					Handle: "docker-volume-handle",
					TTL:    expectedLatestVersionTTL,
				},
				{
					Handle: "crossed-wires-volume-handle",
					TTL:    expectedOldVersionTTL,
				},
			}

			var actualSetVolumeTTLArgs []setVolumeTTLArgs
			for i := range expectedSetVolumeTTLArgs {
				handle, ttl := fakeBaggageCollectorDB.SetVolumeTTLArgsForCall(i)
				actualSetVolumeTTLArgs = append(actualSetVolumeTTLArgs, setVolumeTTLArgs{
					Handle: handle,
					TTL:    ttl,
				})
			}

			Expect(actualSetVolumeTTLArgs).To(ConsistOf(expectedSetVolumeTTLArgs))
		})

		Context("When the job has no previously finished builds", func() {
			var (
				workerABaggageClaimClient *bcfakes.FakeClient
				gitVolume                 *bcfakes.FakeVolume
			)
			BeforeEach(func() {
コード例 #2
0
				}

				var expectedHandles []string
				for handle, expectedTTL := range example.expectedTTLs {
					Expect(fakeVolumes[handle].ReleaseCallCount()).To(Equal(1))
					actualTTL := fakeVolumes[handle].ReleaseArgsForCall(0)
					Expect(actualTTL).To(Equal(worker.FinalTTL(expectedTTL)))
					expectedHandles = append(expectedHandles, handle)
				}

				Expect(actualHandles).To(ConsistOf(expectedHandles))
				Expect(fakeBaggageCollectorDB.SetVolumeTTLCallCount()).To(Equal(len(example.expectedTTLs)))
				actualHandles = nil

				for i := 0; i < fakeBaggageCollectorDB.SetVolumeTTLCallCount(); i++ {
					actualHandle, actualTTL := fakeBaggageCollectorDB.SetVolumeTTLArgsForCall(i)
					actualHandles = append(actualHandles, actualHandle)

					Expect(actualTTL).To(Equal(example.expectedTTLs[actualHandle]))
				}

				Expect(actualHandles).To(ConsistOf(expectedHandles))
			}
		},
		Entry("when there are volumes cached for multiple versions of the resource", baggageCollectionExample{
			pipelineData: map[string][]resourceConfigAndVersions{
				"pipeline-a": []resourceConfigAndVersions{
					{
						config: atc.ResourceConfig{
							Name: "resource-a",
							Type: "some-a-type",