return "some-ref", nil } } }) It("does not return an error as it retries", func() { _, _, err := lockPool.AddUnclaimedLock(lockDir) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeLockHandler.AddLockCallCount()).Should(Equal(2)) }) }) Context("when adding the lock succeeds", func() { BeforeEach(func() { fakeLockHandler.AddLockReturns("some-ref", nil) }) It("tries to broadcast to the lock pool", func() { _, _, err := lockPool.ReleaseLock(lockDir) Ω(err).ShouldNot(HaveOccurred()) Ω(fakeLockHandler.BroadcastLockPoolCallCount()).Should(Equal(1)) }) ValidateSharedBehaviorDuringBroadcastFailures( func() error { _, _, err := lockPool.AddUnclaimedLock(lockDir) return err }, func(expectedNumberOfInteractions int) { Ω(fakeLockHandler.AddLockCallCount()).Should(Equal(expectedNumberOfInteractions))