Skip to content

Commit

Permalink
*: fix flaky testpeers test (#3267)
Browse files Browse the repository at this point in the history
- fix test peers on timeout, sometimes it went in the case where the current context is done, but the result of the currently running test wasn't sent to the channel
- fix wrongly named variables

category: test
ticket: none
  • Loading branch information
KaloyanTanev authored Sep 10, 2024
1 parent 46a5509 commit af6f87b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func testAllBeacons(ctx context.Context, queuedTestCases []testCaseName, allTest

doneReading := make(chan bool)
go func() {
for singlePeerRes := range singleBeaconResCh {
maps.Copy(allBeaconsRes, singlePeerRes)
for singleBeaconRes := range singleBeaconResCh {
maps.Copy(allBeaconsRes, singleBeaconRes)
}
doneReading <- true
}()
Expand Down
4 changes: 2 additions & 2 deletions cmd/testmev.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func testAllMEVs(ctx context.Context, queuedTestCases []testCaseName, allTestCas

doneReading := make(chan bool)
go func() {
for singlePeerRes := range singleMEVResCh {
maps.Copy(allMEVsRes, singlePeerRes)
for singleMEVRes := range singleMEVResCh {
maps.Copy(allMEVsRes, singleMEVRes)
}
doneReading <- true
}()
Expand Down
1 change: 1 addition & 0 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ func runPeerTest(ctx context.Context, queuedTestCases []testCaseName, allTestCas
for _, t := range queuedTestCases {
select {
case <-ctx.Done():
testResCh <- failedTestResult(testResult{Name: t.name}, errTimeoutInterrupted)
return
default:
testResCh <- allTestCases[t](ctx, &conf, tcpNode, target)
Expand Down

0 comments on commit af6f87b

Please sign in to comment.