Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Morris committed Feb 21, 2017
1 parent 39aa0e5 commit a1013cb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/raft/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestInitialElection2A(t *testing.T) {
// is a leader elected?
cfg.checkOneLeader()

// does the leader+term stay the same there is no failure?
// does the leader+term stay the same if there is no network failure?
term1 := cfg.checkTerms()
time.Sleep(2 * RaftElectionTimeout)
term2 := cfg.checkTerms()
Expand Down Expand Up @@ -104,22 +104,22 @@ func TestFailAgree2B(t *testing.T) {
cfg := make_config(t, servers, false)
defer cfg.cleanup()

fmt.Printf("Test (2B): agreement despite follower failure ...\n")
fmt.Printf("Test (2B): agreement despite follower disconnection ...\n")

cfg.one(101, servers)

// follower network failure
// follower network disconnection
leader := cfg.checkOneLeader()
cfg.disconnect((leader + 1) % servers)

// agree despite one failed server?
// agree despite one disconnected server?
cfg.one(102, servers-1)
cfg.one(103, servers-1)
time.Sleep(RaftElectionTimeout)
cfg.one(104, servers-1)
cfg.one(105, servers-1)

// failed server re-connected
// re-connect
cfg.connect((leader + 1) % servers)

// agree with full set of servers?
Expand All @@ -135,7 +135,7 @@ func TestFailNoAgree2B(t *testing.T) {
cfg := make_config(t, servers, false)
defer cfg.cleanup()

fmt.Printf("Test (2B): no agreement if too many followers fail ...\n")
fmt.Printf("Test (2B): no agreement if too many followers disconnect ...\n")

cfg.one(10, servers)

Expand All @@ -160,7 +160,7 @@ func TestFailNoAgree2B(t *testing.T) {
t.Fatalf("%v committed but no majority", n)
}

// repair failures
// repair
cfg.connect((leader + 1) % servers)
cfg.connect((leader + 2) % servers)
cfg.connect((leader + 3) % servers)
Expand Down

0 comments on commit a1013cb

Please sign in to comment.