Skip to content

Commit

Permalink
PR FIXUP - Boost change detector initial subtest speed
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Jul 16, 2024
1 parent 97bd37a commit c1877ab
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/change_detector/change_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"path"
"path/filepath"
"strings"
"sync/atomic"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -59,14 +60,27 @@ func TestChanges(t *testing.T) {
sourceRepoPkgMap[pkg] = true
}

hasRunOnce := &atomic.Bool{}

for _, pkg := range targetRepoPkgList {
pkgName := strings.TrimPrefix(pkg, "github.com/sourcenetwork/defradb/")
t.Run(pkgName, func(t *testing.T) {
if pkg == "" || !sourceRepoPkgMap[pkg] {
t.Skip("skipping unknown or new test package")
}

t.Parallel()
if hasRunOnce.Load() {
// The first test runs very slowly, and if multiple tests are running concurrently
// all will be affected and the costs multiplied. It seems likely that this is
// compilation related, but that is not yet proven.
//
// Because of this the first sub-test will run on it's own, followed by the rest
// running in parallel.
t.Parallel()
} else {
hasRunOnce.Swap(true)
}

dataDir := t.TempDir()

sourceTestPkg := filepath.Join(sourceRepoDir, pkgName)
Expand Down

0 comments on commit c1877ab

Please sign in to comment.