diff --git a/tests/change_detector/change_detector_test.go b/tests/change_detector/change_detector_test.go index badfc45ecb..69138d46b9 100644 --- a/tests/change_detector/change_detector_test.go +++ b/tests/change_detector/change_detector_test.go @@ -20,6 +20,7 @@ import ( "path" "path/filepath" "strings" + "sync/atomic" "testing" "github.com/stretchr/testify/require" @@ -59,6 +60,8 @@ 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) { @@ -66,7 +69,18 @@ func TestChanges(t *testing.T) { 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)