Skip to content

Commit

Permalink
Fix race-test failure in network
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark-icon committed Sep 21, 2023
1 parent 07e8b0e commit accef36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ func generateNetwork(name string, n int, t *testing.T, roles ...module.Role) []*
r := newTestReactor(fmt.Sprintf("%s_%d", name, i), nm, ProtoTestNetwork, t)
r.nt = nt
r.c = c
failIfError(t, r.nt.Listen(), "fail to listen", r.name)
failIfError(t, nm.Start(), "fail to start", r.name)
arr[i] = r
}
return arr
Expand Down Expand Up @@ -562,6 +560,12 @@ func baseNetwork(t *testing.T) (m map[string][]*testReactor, ch chan context.Con
}
}
}
for _, v := range m {
for _, r := range v {
failIfError(t, r.nt.Listen(), "fail to listen", r.name)
failIfError(t, r.nm.Start(), "fail to start", r.name)
}
}

connMap, maxD, err := waitConnection(ch, defaultConnectionLimit, n, 10*DefaultSeedPeriod)
t.Log(time.Now(), "max:", maxD, connMap)
Expand Down

0 comments on commit accef36

Please sign in to comment.