Skip to content

Commit

Permalink
Remove concurrent session creation from raft suite
Browse files Browse the repository at this point in the history
The session creation commands in nwo.Network were to be used with ginkgo and
were not structured for concurrent access. However, one integration test suite
that pushes the boundaries and starts sessions in parallel using go
routines in the test suites.

Removing the go routine prevents a concurrent map access in the network,
simplifies the test, and does not seem to impact the execution time of
the suite. (Before and after execution were both over 9 minutes and the
version without concurrency was 4 seconds faster locally.)

Change-Id: I443f02958ad61e800ff70e8dc6ba622ee14f8461
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Apr 17, 2020
1 parent def6d19 commit 69c9254
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions integration/raft/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"os"
"path/filepath"
"strings"
"sync"
"syscall"
"time"

Expand Down Expand Up @@ -1556,30 +1555,11 @@ func refreshOrdererPEMs(n *nwo.Network) []*certificateChange {

// assertBlockReception asserts that the given orderers have expected heights for the given channel--> height mapping
func assertBlockReception(expectedHeightsPerChannel map[string]int, orderers []*nwo.Orderer, p *nwo.Peer, n *nwo.Network) {
assertReception := func(channelName string, blockSeq int) {
var wg sync.WaitGroup
wg.Add(len(orderers))
for channelName, blockSeq := range expectedHeightsPerChannel {
for _, orderer := range orderers {
go func(orderer *nwo.Orderer) {
defer GinkgoRecover()
defer wg.Done()
waitForBlockReception(orderer, p, n, channelName, blockSeq)
}(orderer)
waitForBlockReception(orderer, p, n, channelName, blockSeq)
}
wg.Wait()
}

var wg sync.WaitGroup
wg.Add(len(expectedHeightsPerChannel))

for channelName, blockSeq := range expectedHeightsPerChannel {
go func(channelName string, blockSeq int) {
defer GinkgoRecover()
defer wg.Done()
assertReception(channelName, blockSeq)
}(channelName, blockSeq)
}
wg.Wait()
}

func waitForBlockReception(o *nwo.Orderer, submitter *nwo.Peer, network *nwo.Network, channelName string, blockSeq int) {
Expand Down

0 comments on commit 69c9254

Please sign in to comment.