}) }) }) Describe("VerifySynced", func() { BeforeEach(func() { consulRPCClient.StatsReturns(map[string]map[string]string{ "raft": map[string]string{ "commit_index": "2", "last_log_index": "2", }, }, nil) }) It("verifies the sync state of the raft log", func() { Expect(client.VerifySynced()).To(Succeed()) Expect(consulRPCClient.StatsCallCount()).To(Equal(1)) }) Context("when the last_log_index never catches up", func() { BeforeEach(func() { consulRPCClient.StatsReturns(map[string]map[string]string{ "raft": map[string]string{ "commit_index": "2", "last_log_index": "1", }, }, nil) }) It("returns an error", func() { Expect(client.VerifySynced()).To(MatchError("log not in sync"))