Skip to content

Commit

Permalink
Investigate hanging issues (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Jun 11, 2019
1 parent 906e2e2 commit 8ed9e1b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/dmsg/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ func TestServer_Serve(t *testing.T) {
})

t.Run("test transport establishment concurrently", func(t *testing.T) {
initiatorsCount := 2
remotesCount := 1
initiatorsCount := 4
remotesCount := 4

initiators := make([]*Client, 0, initiatorsCount)
remotes := make([]*Client, 0, remotesCount)
Expand Down Expand Up @@ -347,7 +347,7 @@ func TestServer_Serve(t *testing.T) {
if _, ok := usedRemotes[i]; ok {
for connect := 0; connect < usedRemotes[i]; connect++ {
// run remotes
go func(remoteInd int) {
go func(remoteInd, conn int) {
var (
transport transport.Transport
err error
Expand All @@ -360,8 +360,10 @@ func TestServer_Serve(t *testing.T) {

remotesTps[remoteInd] = append(remotesTps[remoteInd], transport)

log.Printf("Remote %v with conn %v done", remoteInd, conn)

remotesWG.Done()
}(i)
}(i, connect)
}
}
}
Expand All @@ -386,6 +388,8 @@ func TestServer_Serve(t *testing.T) {

initiatorsTps = append(initiatorsTps, transport)

log.Printf("Initiator %v done", initiatorInd)

initiatorsWG.Done()
}(i)
}
Expand All @@ -397,6 +401,8 @@ func TestServer_Serve(t *testing.T) {
// single error should fail test
require.NoError(t, err)

log.Printf("Initiators all done")

// wait for remotes
remotesWG.Wait()
close(acceptErrs)
Expand Down

0 comments on commit 8ed9e1b

Please sign in to comment.