Skip to content

Commit

Permalink
cmd: fix test peers out of range (#3280)
Browse files Browse the repository at this point in the history
After #3267 was merged, on `ctx.Done()` we push the latest unfinished test. This causes out of range in the outer function in some ocassions.

category: bug
ticket: none
  • Loading branch information
KaloyanTanev authored and pinebit committed Sep 16, 2024
1 parent d468f0c commit b2f25ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,10 @@ func testSinglePeer(ctx context.Context, queuedTestCases []testCaseName, allTest
var testName string
select {
case <-ctx.Done():
testName = queuedTestCases[testCounter].name
allTestRes = append(allTestRes, testResult{Name: testName, Verdict: testVerdictFail, Error: errTimeoutInterrupted})
if testCounter < len(queuedTestCases) {
testName = queuedTestCases[testCounter].name
allTestRes = append(allTestRes, testResult{Name: testName, Verdict: testVerdictFail, Error: errTimeoutInterrupted})
}
finished = true
case result, ok := <-singleTestResCh:
if !ok {
Expand Down

0 comments on commit b2f25ba

Please sign in to comment.