示例#1
0
文件: syncer_test.go 项目: utako/atc
			Ω(otherFakeRunner.RunCallCount()).Should(Equal(1))

			pipelinesDB.GetAllActivePipelinesReturns([]db.SavedPipeline{
				{
					ID: 2,
					Pipeline: db.Pipeline{
						Name: "other-pipeline",
					},
				},
			}, nil)

			syncer.Sync()

			Ω(fakeRunner.RunCallCount()).Should(Equal(1))

			signals, _ := fakeRunner.RunArgsForCall(0)
			Eventually(signals).Should(Receive(Equal(os.Interrupt)))
		})

		Context("when another is configured with the same name", func() {
			It("stops the process", func() {
				Ω(fakeRunner.RunCallCount()).Should(Equal(1))
				Ω(otherFakeRunner.RunCallCount()).Should(Equal(1))

				pipelinesDB.GetAllActivePipelinesReturns([]db.SavedPipeline{
					{
						ID: 2,
						Pipeline: db.Pipeline{
							Name: "other-pipeline",
						},
					},
示例#2
0
	AfterEach(func() {
		close(childRunner1Errors)
		close(childRunner2Errors)
		close(childRunner3Errors)

		Eventually(started).Should(BeClosed())
		groupProcess.Signal(os.Kill)
		Eventually(groupProcess.Wait()).Should(Receive())
	})

	It("runs the first runner, then the second, then becomes ready", func() {
		Eventually(childRunner1.RunCallCount).Should(Equal(1))
		Consistently(childRunner2.RunCallCount, Δ).Should(BeZero())
		Consistently(started, Δ).ShouldNot(BeClosed())
		_, ready := childRunner1.RunArgsForCall(0)
		close(ready)

		Eventually(childRunner2.RunCallCount).Should(Equal(1))
		Consistently(childRunner3.RunCallCount, Δ).Should(BeZero())
		Consistently(started, Δ).ShouldNot(BeClosed())
		_, ready = childRunner2.RunArgsForCall(0)
		close(ready)

		Eventually(childRunner3.RunCallCount).Should(Equal(1))
		Consistently(started, Δ).ShouldNot(BeClosed())
		_, ready = childRunner3.RunArgsForCall(0)
		close(ready)

		Eventually(started).Should(BeClosed())
	})