Exemplo n.º 1
0
								abort    chan<- struct{}
							)

							BeforeEach(func() {
								aborts := make(chan struct{})
								abort = aborts

								notifier = new(dbfakes.FakeNotifier)
								notifier.NotifyReturns(aborts)

								fakeBuildDB.AbortNotifierReturns(notifier, nil)
							})

							It("listens for aborts", func() {
								Ω(fakeBuildDB.AbortNotifierCallCount()).Should(Equal(1))
								Ω(fakeBuildDB.AbortNotifierArgsForCall(0)).Should(Equal(model.ID))
							})

							It("resumes the build", func() {
								Ω(realBuild.ResumeCallCount()).Should(Equal(1))
							})

							It("releases the lock", func() {
								Ω(fakeLock.ReleaseCallCount()).Should(Equal(1))
							})

							It("closes the notifier", func() {
								Ω(notifier.CloseCallCount()).Should(Equal(1))
							})

							Context("when the build is aborted", func() {
Exemplo n.º 2
0
								abort    chan<- struct{}
							)

							BeforeEach(func() {
								aborts := make(chan struct{})
								abort = aborts

								notifier = new(dbfakes.FakeNotifier)
								notifier.NotifyReturns(aborts)

								fakeBuildDB.AbortNotifierReturns(notifier, nil)
							})

							It("listens for aborts", func() {
								Expect(fakeBuildDB.AbortNotifierCallCount()).To(Equal(1))
								Expect(fakeBuildDB.AbortNotifierArgsForCall(0)).To(Equal(model.ID))
							})

							It("resumes the build", func() {
								Expect(realBuild.ResumeCallCount()).To(Equal(1))
							})

							It("breaks the lease", func() {
								Expect(fakeLease.BreakCallCount()).To(Equal(1))
							})

							It("closes the notifier", func() {
								Expect(notifier.CloseCallCount()).To(Equal(1))
							})

							Context("when the build is aborted", func() {