Skip to content

Commit

Permalink
itest: shuffle test cases to even out blocks mined in tranches
Browse files Browse the repository at this point in the history
This commit shuffles all the test cases before running them so tests
which require lots of blocks to be mined are less likely to be run in
the same tranch.

The other benefit is this approach provides a more efficient way to
figure which tests are broken since all the differnet backends are
running different tranches in their builds, we can identify more failed
tests in one push.
  • Loading branch information
yyforyongyu committed Oct 24, 2024
1 parent 8fac9a0 commit bb261f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

package itest

import "github.com/lightningnetwork/lnd/lntest"
import (
"math/rand"

"github.com/lightningnetwork/lnd/lntest"
)

var allTestCases = []*lntest.TestCase{
{
Expand Down Expand Up @@ -683,4 +687,12 @@ var allTestCases = []*lntest.TestCase{
func init() {
// Register subtests.
allTestCases = append(allTestCases, multiHopForceCloseTestCases...)

// Shuffle the test cases so they are executed in a random order. This
// is done to even out the blocks mined in each test tranche so they
// can run faster.
rand.Shuffle(len(allTestCases), func(i, j int) {
allTestCases[i], allTestCases[j] =
allTestCases[j], allTestCases[i]
})
}

0 comments on commit bb261f9

Please sign in to comment.