Use a different seed for random numbers each run

Without this, each run gets the same random numbers so all nodes are
racing to remove the deleted node.
This commit is contained in:
Bryan Boreham committed 2019-10-11 20:29:58 +00:00
1 parent 4d7f0f5014
commit f5c2f51964
2 files changed
+3

No files matched your search

+1
View File
@@ -354,6 +354,7 @@ func main() {
ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
stopCh := make(chan struct{})
rand.Seed(time.Now().UnixNano())
registerForNodeUpdates(c, stopCh, nodeName, peerName)
<-ch
close(stopCh)
+2
View File
@@ -5,6 +5,7 @@ import (
"math/rand"
"sync"
"testing"
"time"
"github.com/stretchr/testify/require"
)
@@ -71,6 +72,7 @@ func doConcurrentIterations(iterations, concurrency int, f func(int)) {
}
func TestPeerListFuzz(t *testing.T) {
rand.Seed(time.Now().UnixNano())
const (
testIters = 1000
maxNodes = 100