當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakePipelineDB.GetJobFinishedAndNextBuildStub方法代碼示例

本文整理匯總了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())
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:31,代碼來源:baggage_collector_images_test.go

示例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
					}
開發者ID:utako,項目名稱:atc,代碼行數:45,代碼來源:jobs_test.go


注:本文中的github.com/concourse/atc/db/fakes.FakePipelineDB.GetJobFinishedAndNextBuildStub方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。