示例#1
0
文件: syncer_test.go 项目: utako/atc
		syncer = NewSyncer(
			lagertest.NewTestLogger("test"),

			pipelinesDB,
			pipelineDBFactory,
			pipelineRunnerFactory,
		)
	})

	JustBeforeEach(func() {
		syncer.Sync()
	})

	It("spawns a new process for each pipeline", func() {
		Ω(fakeRunner.RunCallCount()).Should(Equal(1))
		Ω(otherFakeRunner.RunCallCount()).Should(Equal(1))
	})

	Context("when a pipeline is paused", func() {
		BeforeEach(func() {
			pipelinesDB.GetAllActivePipelinesReturns([]db.SavedPipeline{
				{
					ID: 1,
					Pipeline: db.Pipeline{
						Name: "pipeline",
					},
				},
				{
					ID:     2,
					Paused: true,
示例#2
0
		syncer = NewSyncer(
			lagertest.NewTestLogger("test"),

			syncherDB,
			pipelineDBFactory,
			pipelineRunnerFactory,
		)
	})

	JustBeforeEach(func() {
		syncer.Sync()
	})

	It("spawns a new process for each pipeline", func() {
		Expect(fakeRunner.RunCallCount()).To(Equal(1))
		Expect(otherFakeRunner.RunCallCount()).To(Equal(1))
	})

	Context("when we sync again", func() {
		It("does not spawn any processes again", func() {
			syncer.Sync()
			Expect(fakeRunner.RunCallCount()).To(Equal(1))
		})
	})

	Context("when a pipeline is deleted", func() {
		It("stops the process", func() {
			Expect(fakeRunner.RunCallCount()).To(Equal(1))
			Expect(otherFakeRunner.RunCallCount()).To(Equal(1))