Browse Source

Merge pull request #4047 from heyitsanthony/test-activate-raftexample

test: activate tests on contrib/raftexample
Anthony Romano 10 years ago
parent
commit
0c640d781c
2 changed files with 6 additions and 1 deletions
  1. 5 1
      contrib/raftexample/raftexample_test.go
  2. 1 0
      test

+ 5 - 1
contrib/raftexample/raftexample_test.go

@@ -108,10 +108,14 @@ func TestProposeOnCommit(t *testing.T) {
 				}
 				}
 			}
 			}
 			donec <- struct{}{}
 			donec <- struct{}{}
+			for range cC {
+				// acknowledge the commits from other nodes so
+				// raft continues to make progress
+			}
 		}(clus.proposeC[i], clus.commitC[i], clus.errorC[i])
 		}(clus.proposeC[i], clus.commitC[i], clus.errorC[i])
 
 
 		// one message feedback per node
 		// one message feedback per node
-		go func() { clus.proposeC[i] <- "foo" }()
+		go func(i int) { clus.proposeC[i] <- "foo" }(i)
 	}
 	}
 
 
 	for range clus.peers {
 	for range clus.peers {

+ 1 - 0
test

@@ -58,6 +58,7 @@ go test -timeout 3m ${COVER} -cpu 1,2,4 $@ ${NO_RACE_TEST}
 if [ -n "$INTEGRATION" ]; then
 if [ -n "$INTEGRATION" ]; then
 	echo "Running integration tests..."
 	echo "Running integration tests..."
 	go test -timeout 10m -v -cpu 1,2,4 $@ ${REPO_PATH}/integration
 	go test -timeout 10m -v -cpu 1,2,4 $@ ${REPO_PATH}/integration
+	go test -timeout 1m -v -cpu 1,2,4 $@ ${REPO_PATH}/contrib/raftexample
 fi
 fi
 
 
 echo "Checking gofmt..."
 echo "Checking gofmt..."