Skip to content

Commit ccaebff

Browse files
yacovmsykesm
authored andcommitted
[FAB-12209] Speedup TestShuffle in discovery
The test TestShuffle uses a slice of 1 million elements in order the shuffling to fail with a negligible probability. This runs in 2 seconds without race detector, but - with race detector enabled it runs very very slow (20 seconds). I changed the million to a thousand, and the number of permutations should be still high enough to have the test fail with low probability. FAB-12209 #done Change-Id: I57ccfbe0051055bb470f1c87d44eb813ecd6196e Signed-off-by: yacovm <yacovm@il.ibm.com>
1 parent 56914c8 commit ccaebff

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

discovery/client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ func TestClient(t *testing.T) {
555555
used[name] = struct{}{}
556556
}
557557
}
558-
fmt.Printf("Used peers: %#v\n", used)
558+
t.Logf("Used peers: %#v\n", used)
559559
assert.Equalf(t, len(acceptablePeers), len(used), "expecting each endorser to be returned at least once")
560560
})
561561
}

discovery/client/selection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
func TestShuffle(t *testing.T) {
18-
endorsers := make(Endorsers, 1000000)
18+
endorsers := make(Endorsers, 1000)
1919
for i := 0; i < len(endorsers); i++ {
2020
endorsers[i] = &Peer{
2121
StateInfoMessage: stateInfoWithHeight(uint64(i)),

0 commit comments

Comments
 (0)