Ejemplo n.º 1
0
					})
				})

				Context("when resetting the lock state succeeds", func() {
					It("tries to remove the lock it found in the name file", func() {
						_, _, err := lockPool.RemoveLock(lockDir)
						Ω(err).ShouldNot(HaveOccurred())

						Ω(fakeLockHandler.RemoveLockCallCount()).Should(Equal(1))
						lockName := fakeLockHandler.RemoveLockArgsForCall(0)
						Ω(lockName).Should(Equal("some-remove-lock"))
					})

					Context("when removing the lock fails", func() {
						BeforeEach(func() {
							fakeLockHandler.RemoveLockReturns("", errors.New("disaster"))
						})

						It("returns an error", func() {
							_, _, err := lockPool.RemoveLock(lockDir)
							Ω(err).Should(HaveOccurred())
							Ω(fakeLockHandler.RemoveLockCallCount()).Should(Equal(1))
						})
					})

					Context("when removing the lock succeeds", func() {
						BeforeEach(func() {
							fakeLockHandler.RemoveLockReturns("some-ref", nil)
						})

						It("tries to broadcast to the lock pool", func() {