当前位置: 首页>>代码示例>>Golang>>正文


Golang BuildFactory.Create方法代码示例

本文整理汇总了Golang中github.com/concourse/atc/scheduler/factory.BuildFactory.Create方法的典型用法代码示例。如果您正苦于以下问题:Golang BuildFactory.Create方法的具体用法?Golang BuildFactory.Create怎么用?Golang BuildFactory.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/concourse/atc/scheduler/factory.BuildFactory的用法示例。


在下文中一共展示了BuildFactory.Create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

	})

	Context("when I have a put at the top-level", func() {
		BeforeEach(func() {
			input = atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Put:      "some-put",
						Resource: "some-resource",
					},
				},
			}
		})

		It("returns the correct plan", func() {
			actual, err := buildFactory.Create(input, resources, nil)
			Ω(err).ShouldNot(HaveOccurred())

			expected := atc.Plan{
				OnSuccess: &atc.OnSuccessPlan{
					Step: atc.Plan{
						Location: &atc.Location{
							ParentID:      0,
							ID:            1,
							ParallelGroup: 0,
						},
						Put: &atc.PutPlan{
							Type:     "git",
							Name:     "some-put",
							Resource: "some-resource",
							Pipeline: "some-pipeline",
开发者ID:utako,项目名称:atc,代码行数:31,代码来源:factory_put_test.go

示例2:

		}
	})

	Context("when I have a nested do ", func() {
		It("returns the correct plan", func() {
			actual := buildFactory.Create(atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Do: &atc.PlanSequence{
							{
								Task: "some thing",
							},
							{
								Task: "some thing-2",
							},
							{
								Do: &atc.PlanSequence{
									{
										Task: "some other thing",
									},
								},
							},
						},
					},
				},
			}, resources, nil)

			expected := atc.Plan{
				OnSuccess: &atc.OnSuccessPlan{
					Step: atc.Plan{
						Task: &atc.TaskPlan{
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:factory_do_test.go

示例3:

	})

	Context("with a get at the top-level", func() {
		BeforeEach(func() {
			input = atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Get:      "some-get",
						Resource: "some-resource",
					},
				},
			}
		})

		It("returns the correct plan", func() {
			actual, err := buildFactory.Create(input, resources, resourceTypes, nil)
			Expect(err).NotTo(HaveOccurred())

			expected := expectedPlanFactory.NewPlan(atc.GetPlan{
				Type:     "git",
				Name:     "some-get",
				Resource: "some-resource",
				Pipeline: "some-pipeline",
				Source: atc.Source{
					"uri": "git://some-resource",
				},
				ResourceTypes: resourceTypes,
			})
			Expect(actual).To(testhelpers.MatchPlan(expected))
		})
	})
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:factory_get_test.go

示例4:

		resourceTypes = atc.ResourceTypes{
			{
				Name:   "some-custom-resource",
				Type:   "docker-image",
				Source: atc.Source{"some": "custom-source"},
			},
		}
	})

	Context("when there is a task annotated with 'attempts'", func() {
		It("builds correctly", func() {
			actual, err := buildFactory.Create(atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Task:     "second task",
						Attempts: 3,
					},
				},
			}, nil, resourceTypes, nil)
			Expect(err).NotTo(HaveOccurred())

			expected := expectedPlanFactory.NewPlan(atc.RetryPlan{
				expectedPlanFactory.NewPlan(atc.TaskPlan{
					Name:          "second task",
					Pipeline:      "some-pipeline",
					ResourceTypes: resourceTypes,
				}),
				expectedPlanFactory.NewPlan(atc.TaskPlan{
					Name:          "second task",
					Pipeline:      "some-pipeline",
					ResourceTypes: resourceTypes,
开发者ID:pcfdev-forks,项目名称:atc,代码行数:31,代码来源:factory_retry_test.go

示例5:

		fakeLocationPopulator = &fakes.FakeLocationPopulator{}

		buildFactory = factory.NewBuildFactory(
			"some-pipeline",
			fakeLocationPopulator,
		)
	})

	Context("When there is a task wrapped in a try", func() {
		It("builds correctly", func() {
			actual := buildFactory.Create(atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Try: &atc.PlanConfig{
							Task: "first task",
						},
					},
					{
						Task: "second task",
					},
				},
			}, nil, nil)

			expected := atc.Plan{
				OnSuccess: &atc.OnSuccessPlan{
					Step: atc.Plan{
						Try: &atc.TryPlan{
							Step: atc.Plan{
								Task: &atc.TaskPlan{
									Name:     "first task",
									Pipeline: "some-pipeline",
								},
开发者ID:ACPK,项目名称:atc,代码行数:32,代码来源:factory_try_test.go

示例6:

	BeforeEach(func() {
		fakeLocationPopulator = &fakes.FakeLocationPopulator{}

		buildFactory = factory.NewBuildFactory(
			"some-pipeline",
			fakeLocationPopulator,
		)
	})

	Context("When there is a task with a timeout", func() {
		It("builds correctly", func() {
			actual := buildFactory.Create(atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Task:    "first task",
						Timeout: "10s",
					},
				},
			}, nil, nil)

			expected := atc.Plan{
				Timeout: &atc.TimeoutPlan{
					Duration: "10s",
					Step: atc.Plan{
						Task: &atc.TaskPlan{
							Name:     "first task",
							Pipeline: "some-pipeline",
						},
					},
				},
			}
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:factory_timeout_test.go

示例7:

								Task: "those who also resist our will",
							},
							{
								Task: "third task",
							},
						},
						Failure: &atc.PlanConfig{
							Task: "some other failure",
						},
					},
				},
			}
		})

		It("builds the plan correctly", func() {
			actual := buildFactory.Create(input, resources, nil)

			expected := atc.Plan{
				OnFailure: &atc.OnFailurePlan{
					Step: atc.Plan{
						OnSuccess: &atc.OnSuccessPlan{
							Step: atc.Plan{
								Task: &atc.TaskPlan{
									Name:     "those who resist our will",
									Pipeline: "some-pipeline",
								},
							},
							Next: atc.Plan{
								OnSuccess: &atc.OnSuccessPlan{
									Step: atc.Plan{
										Task: &atc.TaskPlan{
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:factory_hooks_test.go

示例8:

				Name:   "some-resource",
				Type:   "git",
				Source: atc.Source{"uri": "git://some-resource"},
			},
		}
	})

	Context("when I have one aggregate", func() {
		It("returns the correct plan", func() {
			actual := buildFactory.Create(atc.JobConfig{
				Plan: atc.PlanSequence{
					{
						Aggregate: &atc.PlanSequence{
							{
								Task: "some thing",
							},
							{
								Task: "some other thing",
							},
						},
					},
				},
			}, resources, nil)

			expected := atc.Plan{
				Aggregate: &atc.AggregatePlan{
					{
						Task: &atc.TaskPlan{
							Name:     "some thing",
							Pipeline: "some-pipeline",
						},
					},
开发者ID:ACPK,项目名称:atc,代码行数:32,代码来源:factory_aggregate_test.go

示例9:

		})

		Context("with a put at the top-level", func() {
			BeforeEach(func() {
				input = atc.JobConfig{
					Plan: atc.PlanSequence{
						{
							Put:      "some-put",
							Resource: "some-resource",
						},
					},
				}
			})

			It("returns the correct plan", func() {
				actual := buildFactory.Create(input, resources, nil)

				expected := atc.Plan{
					OnSuccess: &atc.OnSuccessPlan{
						Step: atc.Plan{
							Location: &atc.Location{
								ParentID:      0,
								ID:            1,
								ParallelGroup: 0,
							},
							Put: &atc.PutPlan{
								Type:     "git",
								Name:     "some-put",
								Resource: "some-resource",
								Pipeline: "some-pipeline",
								Source: atc.Source{
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:factory_put_test.go


注:本文中的github.com/concourse/atc/scheduler/factory.BuildFactory.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。