Skip to content

Instantly share code, notes, and snippets.

@wjdix
Created September 27, 2013 19:42
Show Gist options
  • Save wjdix/6734138 to your computer and use it in GitHub Desktop.
Save wjdix/6734138 to your computer and use it in GitHub Desktop.
c := newCluster(3).withChannelPeers().withStateMachine(buildThrowAwayStateMachine).withTimeouts(2, 9, 9)
c.startChannelPeers()
c.startElectionTimers()
c.server(1).StartElection()
c.partition(3)
c.server(1).AppendEntries("A")
c.server(1).AppendEntries("B")
expect(c.server(3).CommitIndex).To.Equal(0)
c.healPartition(3)
c.partition(2)
expect(c.server(3).CommitIndex).To.Equal(0)
c.server(1).AppendEntries("C")
expect(c.server(1).CommitIndex).To.Equal(3)
expect(c.server(3).CommitIndex).To.Equal(2)
expect(len(c.server(3).Log)).To.Equal(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment