From c1877abfd288ab86976dd23882bd4aca4762bdab Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Tue, 16 Jul 2024 15:16:33 -0400 Subject: [PATCH] PR FIXUP - Boost change detector initial subtest speed --- tests/change_detector/change_detector_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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)