Browse Source

raft: better comment and naming

Xiang Li 11 years ago
parent
commit
5c884c7797
1 changed files with 5 additions and 3 deletions
  1. 5 3
      raft/node_test.go

+ 5 - 3
raft/node_test.go

@@ -96,7 +96,7 @@ func TestBlockProposal(t *testing.T) {
 		errc <- n.Propose(context.TODO(), []byte("somedata"))
 		errc <- n.Propose(context.TODO(), []byte("somedata"))
 	}()
 	}()
 
 
-	mustEnoughSched()
+	forceGoSched()
 	select {
 	select {
 	case err := <-errc:
 	case err := <-errc:
 		t.Errorf("err = %v, want blocking", err)
 		t.Errorf("err = %v, want blocking", err)
@@ -104,7 +104,7 @@ func TestBlockProposal(t *testing.T) {
 	}
 	}
 
 
 	n.Campaign(context.TODO())
 	n.Campaign(context.TODO())
-	mustEnoughSched()
+	forceGoSched()
 	select {
 	select {
 	case err := <-errc:
 	case err := <-errc:
 		if err != nil {
 		if err != nil {
@@ -213,7 +213,9 @@ func TestIsStateEqual(t *testing.T) {
 	}
 	}
 }
 }
 
 
-func mustEnoughSched() {
+// WARNING: This is a hack.
+// Remove this when we are able to block/check the status of the go-routines.
+func forceGoSched() {
 	// possibility enough to sched upto 10 go routines.
 	// possibility enough to sched upto 10 go routines.
 	for i := 0; i < 10000; i++ {
 	for i := 0; i < 10000; i++ {
 		runtime.Gosched()
 		runtime.Gosched()