savedPipeline = db.SavedPipeline{
				Pipeline: db.Pipeline{
					Name: "my-special-pipeline",
					Config: atc.Config{
						Groups:    atc.GroupConfigs{},
						Resources: atc.ResourceConfigs{},
						Jobs: atc.JobConfigs{
							{
								Name: "my-precious-job",
							},
						},
					},
				},
			}

			fakeBaggageCollectorDB.GetAllPipelinesReturns([]db.SavedPipeline{savedPipeline}, nil)

			imageVersionMap := map[int][]db.VolumeIdentifier{
				2: {
					{
						ResourceVersion: atc.Version{"ref": "rence"},
						ResourceHash:    "git:zxcvbnm",
					},
					{
						ResourceVersion: atc.Version{"digest": "readers"},
						ResourceHash:    "docker:qwertyuiop",
					},
				},
				3: {
					{
						ResourceVersion: atc.Version{"ref": "rence"},
Пример #2
0
					}

					fakePipelineDB.GetLatestEnabledVersionedResourceStub = func(resourceName string) (db.SavedVersionedResource, bool, error) {
						savedVersions := savedVersionsForEachResource[resourceName]

						if len(savedVersions) == 0 {
							return db.SavedVersionedResource{}, false, nil
						}

						return savedVersions[len(savedVersions)-1], true, nil
					}

					fakePipelineDBs[name] = fakePipelineDB
				}

				fakeBaggageCollectorDB.GetAllPipelinesReturns(savedPipelines, nil)

				fakePipelineDBFactory.BuildStub = func(savedPipeline db.SavedPipeline) db.PipelineDB {
					return fakePipelineDBs[savedPipeline.Name]
				}

				fakeVolumes := map[string]*bcfakes.FakeVolume{}

				var savedVolumes []db.SavedVolume
				for _, volume := range example.volumeData {
					savedVolumes = append(savedVolumes, db.SavedVolume{
						Volume: volume,
					})
					fakeVolumes[volume.Handle] = new(bcfakes.FakeVolume)
				}