示例#1
0
	})

	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",
示例#2
0
		}
	})

	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{
示例#3
0
	})

	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))
		})
	})
示例#4
0
		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,
示例#5
0
		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",
								},
示例#6
0
	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",
						},
					},
				},
			}
示例#7
0
								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{
示例#8
0
				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",
						},
					},
示例#9
0
		})

		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{