Example #1
0
				Ω(err).ShouldNot(HaveOccurred())

				build.Resume(logger)

				Ω(inputStep.RunCallCount()).Should(Equal(1))
				Ω(inputStep.ReleaseCallCount()).Should(BeNumerically(">", 0))

				Ω(taskStep.RunCallCount()).Should(Equal(1))
				Ω(inputStep.ReleaseCallCount()).Should(BeNumerically(">", 0))

				Ω(outputStep.RunCallCount()).Should(Equal(0))
				Ω(outputStep.ReleaseCallCount()).Should(Equal(0))

				_, cbErr, successful, aborted := fakeDelegate.FinishArgsForCall(0)
				Ω(cbErr).ShouldNot(HaveOccurred())
				Ω(successful).Should(Equal(exec.Success(false)))
				Ω(aborted).Should(BeFalse())
			})
		})

		Context("when a step in the aggregate fails the step fails", func() {
			BeforeEach(func() {
				inputStep.ResultStub = successResult(false)
			})

			It("only run the failure hooks", func() {
				plan := atc.Plan{
					Location: &atc.Location{},
					OnSuccess: &atc.OnSuccessPlan{
						Step: atc.Plan{
							Location: &atc.Location{},
Example #2
0
				Expect(err).NotTo(HaveOccurred())

				build.Resume(logger)

				Expect(inputStep.RunCallCount()).To(Equal(1))
				Expect(inputStep.ReleaseCallCount()).To(Equal(1))

				Expect(taskStep.RunCallCount()).To(Equal(1))
				Expect(inputStep.ReleaseCallCount()).To(Equal(1))

				Expect(outputStep.RunCallCount()).To(Equal(0))
				Expect(outputStep.ReleaseCallCount()).To(Equal(0))

				_, cbErr, successful, aborted := fakeDelegate.FinishArgsForCall(0)
				Expect(cbErr).NotTo(HaveOccurred())
				Expect(successful).To(Equal(exec.Success(false)))
				Expect(aborted).To(BeFalse())
			})
		})

		Context("when a step in the aggregate fails the step fails", func() {
			BeforeEach(func() {
				inputStep.ResultStub = successResult(false)
			})

			It("only run the failure hooks", func() {
				plan := atc.Plan{
					Location: &atc.Location{},
					OnSuccess: &atc.OnSuccessPlan{
						Step: atc.Plan{
							Location: &atc.Location{},
Example #3
0
							Location: &atc.Location{},
							Task: &atc.TaskPlan{
								Name:   "some-resource",
								Config: &atc.TaskConfig{},
							},
						},
					},
				}

				build, err := execEngine.CreateBuild(buildModel, plan)

				Ω(err).ShouldNot(HaveOccurred())

				build.Resume(logger)

				Ω(inputStep.RunCallCount()).Should(Equal(1))
				Ω(inputStep.ReleaseCallCount()).Should((BeNumerically(">", 0)))

				Ω(taskStep.RunCallCount()).Should(Equal(0))

				Ω(fakeDelegate.FinishCallCount()).Should(Equal(1))

				_, err, succeeded, aborted := fakeDelegate.FinishArgsForCall(0)
				Ω(err.Error()).Should(ContainSubstring(exec.ErrStepTimedOut.Error()))
				Ω(succeeded).Should(Equal(exec.Success(false)))
				Ω(aborted).Should(BeFalse())
			})
		})
	})
})