本文整理匯總了Golang中github.com/concourse/atc/db/fakes.FakePipelineDB.GetJobFinishedAndNextBuildStub方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakePipelineDB.GetJobFinishedAndNextBuildStub方法的具體用法?Golang FakePipelineDB.GetJobFinishedAndNextBuildStub怎麽用?Golang FakePipelineDB.GetJobFinishedAndNextBuildStub使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/concourse/atc/db/fakes.FakePipelineDB
的用法示例。
在下文中一共展示了FakePipelineDB.GetJobFinishedAndNextBuildStub方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
[]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())
示例2:
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
}