[]db.VolumeIdentifier{
					{
						ResourceVersion: atc.Version{"ref": "rence"},
						ResourceHash:    "git:zxcvbnm",
					},
				},
				nil,
			)

			fakePipelineDB = new(dbfakes.FakePipelineDB)
			fakePipelineDB.GetJobFinishedAndNextBuildStub = func(jobName string) (*db.Build, *db.Build, error) {
				switch jobName {
				case "job-a1":
					return &db.Build{ID: 1}, nil, nil
				case "job-a2":
					return &db.Build{ID: 2}, nil, nil
				case "job-b1":
					return &db.Build{ID: 3}, nil, nil
				default:
					panic("unknown job name")
				}
			}
			fakePipelineDBFactory.BuildReturns(fakePipelineDB)
		})

		DescribeTable("It preserves a single volume per worker corresponding to that image resource",
			func(savedVolumes []db.SavedVolume) {
				fakeBaggageCollectorDB.GetVolumesReturns(savedVolumes, nil)

				err := baggageCollector.Collect()
				Expect(err).NotTo(HaveOccurred())
Beispiel #2
0
					pipelineDB.GetJobFinishedAndNextBuildStub = func(jobName string) (*db.Build, *db.Build, error) {
						call++

						var finishedBuild, nextBuild *db.Build

						switch call {
						case 1:
							Ω(jobName).Should(Equal("job-1"))

							finishedBuild = &db.Build{
								ID:           1,
								Name:         "1",
								JobName:      jobName,
								PipelineName: "another-pipeline",
								Status:       db.StatusSucceeded,
							}

							nextBuild = &db.Build{
								ID:           3,
								Name:         "2",
								JobName:      jobName,
								PipelineName: "another-pipeline",
								Status:       db.StatusStarted,
							}

						case 2:
							Ω(jobName).Should(Equal("job-2"))

							finishedBuild = &db.Build{
								ID:           4,
								Name:         "1",
								JobName:      "job-2",
								PipelineName: "another-pipeline",
								Status:       db.StatusSucceeded,
							}

						case 3:
							Ω(jobName).Should(Equal("job-3"))

						default:
							panic("unexpected call count")
						}

						return finishedBuild, nextBuild, nil
					}