From 6f68ef6baf28041dcf82ba667d83fc61ae39e9d2 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Wed, 11 Nov 2026 16:36:30 -0500 Subject: [PATCH 1/3] test: add t.Parallel to wave 3 unit tests (tools, plugins, misc) Covers tools/ci-testshard, tools/plugout, tools/gomod-local-update, plugins, internal/testdb, core/services/versioning, core/services/llo/telem, core/services/pipeline/eautils and core/shutdown. Tests that must stay sequential are marked with //nolint:paralleltest and a reason: AllocsPerRun reads global counters, freeport assertions depend on concurrent allocation, and llo/telem subtests share one telemeter. --- core/services/llo/telem/telemetry_test.go | 18 ++++++------ .../services/pipeline/eautils/eautils_test.go | 2 ++ core/services/versioning/orm_test.go | 19 ++++++------ core/shutdown/shutdown_test.go | 2 +- internal/testdb/testdb_test.go | 4 +++ plugins/cmd_test.go | 2 ++ plugins/env_test.go | 4 +++ plugins/loop_registry_test.go | 2 ++ plugins/medianpoc/data_source_test.go | 3 ++ plugins/medianpoc/plugin_test.go | 1 + tools/ci-testshard/main_test.go | 20 +++++++++++++ .../internal/updater/config_test.go | 5 ++++ .../internal/updater/updater_test.go | 3 ++ tools/plugout/main_test.go | 29 +++++++++++++++++++ 14 files changed, 95 insertions(+), 19 deletions(-) diff --git a/core/services/llo/telem/telemetry_test.go b/core/services/llo/telem/telemetry_test.go index d8487cea53e..c32afdcc6f2 100644 --- a/core/services/llo/telem/telemetry_test.go +++ b/core/services/llo/telem/telemetry_test.go @@ -144,7 +144,7 @@ func Test_Telemeter_v3PremiumLegacy(t *testing.T) { donID := uint32(1) opts := &mockOpts{} - t.Run("with error", func(t *testing.T) { + t.Run("with error", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint tm := newTelemeter(TelemeterParams{ Logger: lggr, MonitoringEndpoint: m, @@ -152,12 +152,12 @@ func Test_Telemeter_v3PremiumLegacy(t *testing.T) { }) servicetest.Run(t, tm) - t.Run("if error is some random failure returns immediately", func(t *testing.T) { + t.Run("if error is some random failure returns immediately", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint // should return immediately and not even send on the channel m.chTypedLogs = nil tm.EnqueueV3PremiumLegacy(run, trrs, streamID, opts, nil, errors.New("test error")) }) - t.Run("if error is dp invariant violation, sets this flag", func(t *testing.T) { + t.Run("if error is dp invariant violation, sets this flag", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint m.chTypedLogs = make(chan typedLog, 100) adapterError := new(eautils.AdapterError) adapterError.Name = adapterLWBAErrorName @@ -177,7 +177,7 @@ func Test_Telemeter_v3PremiumLegacy(t *testing.T) { } }) }) - t.Run("with decimal value, sets all values correctly", func(t *testing.T) { + t.Run("with decimal value, sets all values correctly", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint tm := newTelemeter(TelemeterParams{ Logger: lggr, MonitoringEndpoint: m, @@ -233,7 +233,7 @@ func Test_Telemeter_v3PremiumLegacy(t *testing.T) { i++ } }) - t.Run("with quote value", func(t *testing.T) { + t.Run("with quote value", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint tm := newTelemeter(TelemeterParams{ Logger: lggr, MonitoringEndpoint: m, @@ -430,7 +430,7 @@ func Test_Telemeter_outcomeTelemetry(t *testing.T) { ch := tm.GetOutcomeTelemetryCh() require.NotNil(t, ch) - t.Run("zero values", func(t *testing.T) { + t.Run("zero values", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint opts := &mockOpts{} cd := opts.ConfigDigest() orig := &lloprotocol.LLOOutcomeTelemetry{SeqNr: opts.SeqNr(), ConfigDigest: cd[:]} @@ -459,7 +459,7 @@ func Test_Telemeter_outcomeTelemetry(t *testing.T) { assert.Zero(t, decoded.DonId) }) - t.Run("with values", func(t *testing.T) { + t.Run("with values", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint opts := &mockOpts{} cd := opts.ConfigDigest() orig := &lloprotocol.LLOOutcomeTelemetry{ @@ -645,7 +645,7 @@ func Test_Telemeter_reportTelemetry(t *testing.T) { ch := tm.GetReportTelemetryCh() require.NotNil(t, ch) - t.Run("zero values", func(t *testing.T) { + t.Run("zero values", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint opts := &mockOpts{} cd := opts.ConfigDigest() orig := &lloprotocol.LLOReportTelemetry{SeqNr: opts.SeqNr(), ConfigDigest: cd[:]} @@ -676,7 +676,7 @@ func Test_Telemeter_reportTelemetry(t *testing.T) { assert.Equal(t, cd[:], decoded.ConfigDigest) }) - t.Run("with values", func(t *testing.T) { + t.Run("with values", func(t *testing.T) { //nolint:paralleltest // subtests share one telemeter and its mock endpoint opts := &mockOpts{} cd := opts.ConfigDigest() orig := &lloprotocol.LLOReportTelemetry{ diff --git a/core/services/pipeline/eautils/eautils_test.go b/core/services/pipeline/eautils/eautils_test.go index 80183b80d2b..9c374c11bb6 100644 --- a/core/services/pipeline/eautils/eautils_test.go +++ b/core/services/pipeline/eautils/eautils_test.go @@ -8,6 +8,7 @@ import ( ) func TestBestEffortExtractEAStatus(t *testing.T) { + t.Parallel() tests := []struct { name string arg []byte @@ -53,6 +54,7 @@ func TestBestEffortExtractEAStatus(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() code, ok := BestEffortExtractEAStatus(tt.arg) assert.Equal(t, tt.expectCode, code) assert.Equal(t, tt.expectOk, ok) diff --git a/core/services/versioning/orm_test.go b/core/services/versioning/orm_test.go index 463589dae7f..df46bb3523e 100644 --- a/core/services/versioning/orm_test.go +++ b/core/services/versioning/orm_test.go @@ -14,9 +14,10 @@ import ( func TestORM_NodeVersion_UpsertNodeVersion(t *testing.T) { ctx := t.Context() - db := pgtest.NewSqlxDB(t) t.Run("With App Version Check", func(t *testing.T) { + t.Parallel() + db := pgtest.NewSqlxDB(t) orm := NewORM(db, logger.TestLogger(t)) err := orm.UpsertNodeVersion(ctx, NewNodeVersion("9.9.8")) @@ -60,6 +61,7 @@ func TestORM_NodeVersion_UpsertNodeVersion(t *testing.T) { require.Equal(t, "9.9.9", ver.Version) }) t.Run("Without App Version Check", func(t *testing.T) { + db := pgtest.NewSqlxDB(t) orm := NewORM(db, logger.TestLogger(t)) // Set the environment variable to skip the app version check t.Setenv("CL_SKIP_APP_VERSION_CHECK", "true") @@ -87,6 +89,7 @@ func TestORM_NodeVersion_UpsertNodeVersion(t *testing.T) { } func Test_Version_CheckVersion(t *testing.T) { + t.Parallel() ctx := t.Context() db := pgtest.NewSqlxDB(t) @@ -131,12 +134,8 @@ func Test_Version_CheckVersion(t *testing.T) { } func TestORM_CheckVersion_CCIP(t *testing.T) { + t.Parallel() ctx := t.Context() - db := pgtest.NewSqlxDB(t) - - lggr := logger.TestLogger(t) - - orm := NewORM(db, lggr) tests := []struct { name string @@ -196,11 +195,12 @@ func TestORM_CheckVersion_CCIP(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - _, err := db.ExecContext(ctx, `TRUNCATE node_versions;`) - require.NoError(t, err) + t.Parallel() + db := pgtest.NewSqlxDB(t) + orm := NewORM(db, logger.TestLogger(t)) require.NoError(t, orm.UpsertNodeVersion(ctx, NewNodeVersion(test.currentVersion))) - _, _, err = CheckVersion(ctx, db, lggr, test.newVersion, false) + _, _, err := CheckVersion(ctx, db, logger.TestLogger(t), test.newVersion, false) if test.expectedError { require.Error(t, err) } else { @@ -211,6 +211,7 @@ func TestORM_CheckVersion_CCIP(t *testing.T) { } func TestORM_NodeVersion_FindLatestNodeVersion(t *testing.T) { + t.Parallel() ctx := t.Context() db := pgtest.NewSqlxDB(t) orm := NewORM(db, logger.TestLogger(t)) diff --git a/core/shutdown/shutdown_test.go b/core/shutdown/shutdown_test.go index c479e57730f..77682b2f9e0 100644 --- a/core/shutdown/shutdown_test.go +++ b/core/shutdown/shutdown_test.go @@ -23,7 +23,7 @@ func TestHandleShutdown(t *testing.T) { //nolint:paralleltest // sends process-w "SIGTERM": syscall.SIGTERM, } - for name, sig := range tests { + for name, sig := range tests { //nolint:paralleltest // subtests send process-wide OS signals t.Run(name, func(t *testing.T) { ctx, cancel := context.WithCancel(t.Context()) go HandleShutdown(func(string) { diff --git a/internal/testdb/testdb_test.go b/internal/testdb/testdb_test.go index 27f856700bd..821d2d8e9a9 100644 --- a/internal/testdb/testdb_test.go +++ b/internal/testdb/testdb_test.go @@ -10,6 +10,7 @@ func TestMigrator_Hash(t *testing.T) { t.Parallel() t.Run("empty returns empty", func(t *testing.T) { + t.Parallel() m := migratorConfig(false) hash, err := m.Hash() require.NoError(t, err) @@ -17,6 +18,7 @@ func TestMigrator_Hash(t *testing.T) { }) t.Run("withTemplate hashes successfully", func(t *testing.T) { + t.Parallel() m := migratorConfig(true) hash, err := m.Hash() require.NoError(t, err) @@ -25,6 +27,7 @@ func TestMigrator_Hash(t *testing.T) { }) t.Run("withTemplate returns same hash from new migrator instances", func(t *testing.T) { + t.Parallel() hash1, err := migratorConfig(true).Hash() require.NoError(t, err) @@ -34,6 +37,7 @@ func TestMigrator_Hash(t *testing.T) { }) } +//nolint:paralleltest // testing.AllocsPerRun reads process-global allocation counters func TestMigrator_HashCachedNoAllocs(t *testing.T) { m := migratorConfig(true) _, err := m.Hash() diff --git a/plugins/cmd_test.go b/plugins/cmd_test.go index 1535bc0bba7..e8ae3626af7 100644 --- a/plugins/cmd_test.go +++ b/plugins/cmd_test.go @@ -9,6 +9,7 @@ import ( ) func TestNewCmdFactory_RegisterSuccess(t *testing.T) { + t.Parallel() mockRegister := func(id string) (*RegisteredLoop, error) { return &RegisteredLoop{EnvCfg: loop.EnvConfig{}}, nil } @@ -31,6 +32,7 @@ func TestNewCmdFactory_RegisterSuccess(t *testing.T) { } func TestNewCmdFactory_RegisterFail(t *testing.T) { + t.Parallel() mockRegister := func(id string) (*RegisteredLoop, error) { return nil, errors.New("registration failed") } diff --git a/plugins/env_test.go b/plugins/env_test.go index 6dd171b6cc0..653c0f7d8d4 100644 --- a/plugins/env_test.go +++ b/plugins/env_test.go @@ -9,16 +9,20 @@ import ( ) func TestParseEnvFile(t *testing.T) { + t.Parallel() t.Run("valid", func(t *testing.T) { + t.Parallel() got, err := ParseEnvFile("testdata/valid.env") require.NoError(t, err) require.Equal(t, []string{"GOMEMLIMIT=1MiB"}, got) }) t.Run("invalid", func(t *testing.T) { + t.Parallel() _, err := ParseEnvFile("testdata/invalid.env") require.Error(t, err) }) t.Run("missing", func(t *testing.T) { + t.Parallel() _, err := ParseEnvFile("testdata/missing.env") require.ErrorIs(t, err, os.ErrNotExist) }) diff --git a/plugins/loop_registry_test.go b/plugins/loop_registry_test.go index 544ba45deed..d830a0308b8 100644 --- a/plugins/loop_registry_test.go +++ b/plugins/loop_registry_test.go @@ -16,6 +16,7 @@ import ( coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" ) +//nolint:paralleltest // asserts consecutive ports from the shared freeport allocator func TestPluginPortManager(t *testing.T) { // register one m := NewTestLoopRegistry(logger.Test(t)) @@ -229,6 +230,7 @@ func (t mockCfgTransmitter) ReaperFrequency() time.Duration { return time.Hour } func (t mockCfgTransmitter) ReaperMaxAge() time.Duration { return time.Minute } func TestLoopRegistry_Register(t *testing.T) { + t.Parallel() mockCfgDatabase := &mockCfgDatabase{} mockCfgMercury := &mockCfgMercury{} mockCfgTracing := &mockCfgTracing{} diff --git a/plugins/medianpoc/data_source_test.go b/plugins/medianpoc/data_source_test.go index fef4ae0ef5c..d2a37f7b3b1 100644 --- a/plugins/medianpoc/data_source_test.go +++ b/plugins/medianpoc/data_source_test.go @@ -32,6 +32,7 @@ func (m *mockPipelineRunner) ExecuteRun(ctx context.Context, spec string, vars c } func TestDataSource(t *testing.T) { + t.Parallel() lggr := logger.TestLogger(t) expect := jsonserializable.JSONSerializable{Val: int64(3), Valid: true} pr := &mockPipelineRunner{ @@ -69,6 +70,7 @@ func TestDataSource(t *testing.T) { } func TestDataSource_ResultErrors(t *testing.T) { + t.Parallel() lggr := logger.TestLogger(t) pr := &mockPipelineRunner{ results: core.TaskResults{ @@ -92,6 +94,7 @@ func TestDataSource_ResultErrors(t *testing.T) { } func TestDataSource_ResultNotAnInt(t *testing.T) { + t.Parallel() lggr := logger.TestLogger(t) expect := jsonserializable.JSONSerializable{Val: "string-result", Valid: true} diff --git a/plugins/medianpoc/plugin_test.go b/plugins/medianpoc/plugin_test.go index 052fee1bca1..60b4566e67d 100644 --- a/plugins/medianpoc/plugin_test.go +++ b/plugins/medianpoc/plugin_test.go @@ -80,6 +80,7 @@ func (p provider) Codec() types.Codec { } func TestNewPlugin(t *testing.T) { + t.Parallel() lggr := logger.TestLogger(t) p := NewPlugin(lggr) diff --git a/tools/ci-testshard/main_test.go b/tools/ci-testshard/main_test.go index 3ee665ec6e6..6a3d5c1eae7 100644 --- a/tools/ci-testshard/main_test.go +++ b/tools/ci-testshard/main_test.go @@ -9,6 +9,7 @@ import ( ) func TestReadPackagesRejectsDuplicatePaths(t *testing.T) { + t.Parallel() _, err := readPackages(strings.NewReader("pkg/a\npkg/a\n")) if err == nil || !strings.Contains(err.Error(), `duplicate package path "pkg/a"`) { t.Fatalf("expected duplicate package error, got %v", err) @@ -16,6 +17,7 @@ func TestReadPackagesRejectsDuplicatePaths(t *testing.T) { } func TestReadPackagesRejectsEmptyInput(t *testing.T) { + t.Parallel() _, err := readPackages(strings.NewReader("\n\n")) if err == nil || !strings.Contains(err.Error(), "no package paths provided on stdin") { t.Fatalf("expected empty input error, got %v", err) @@ -23,6 +25,7 @@ func TestReadPackagesRejectsEmptyInput(t *testing.T) { } func TestReadPackagesTrimsWhitespace(t *testing.T) { + t.Parallel() packages, err := readPackages(strings.NewReader(" pkg/a \n\tpkg/b\t\n")) if err != nil { t.Fatalf("readPackages failed: %v", err) @@ -33,6 +36,7 @@ func TestReadPackagesTrimsWhitespace(t *testing.T) { } func TestReadPackagesIgnoresBlankLinesBetweenPackages(t *testing.T) { + t.Parallel() packages, err := readPackages(strings.NewReader("pkg/a\n\n \n\t\npkg/b\n")) if err != nil { t.Fatalf("readPackages failed: %v", err) @@ -43,6 +47,7 @@ func TestReadPackagesIgnoresBlankLinesBetweenPackages(t *testing.T) { } func TestReadPackagesRejectsDuplicatePathsAfterTrimming(t *testing.T) { + t.Parallel() _, err := readPackages(strings.NewReader("pkg/a\n pkg/a \n")) if err == nil || !strings.Contains(err.Error(), `duplicate package path "pkg/a"`) { t.Fatalf("expected duplicate package error after trimming, got %v", err) @@ -50,6 +55,7 @@ func TestReadPackagesRejectsDuplicatePathsAfterTrimming(t *testing.T) { } func TestListReturnsPartitionWithoutOverlap(t *testing.T) { + t.Parallel() input := "pkg/a\npkg/b\npkg/c\npkg/d\n" seen := make(map[string]struct{}) @@ -71,6 +77,7 @@ func TestListReturnsPartitionWithoutOverlap(t *testing.T) { } func TestListWithSingleShardReturnsEntireInputInOrder(t *testing.T) { + t.Parallel() input := "pkg/a\npkg/b\npkg/c\n" packages := runListForTest(t, input, 1, 0) want := []string{"pkg/a", "pkg/b", "pkg/c"} @@ -85,6 +92,7 @@ func TestListWithSingleShardReturnsEntireInputInOrder(t *testing.T) { } func TestListProducesDeterministicOutput(t *testing.T) { + t.Parallel() input := "pkg/a\npkg/b\npkg/c\npkg/d\npkg/e\n" first := runListOutputForTest(t, input, 4, 2) second := runListOutputForTest(t, input, 4, 2) @@ -94,6 +102,7 @@ func TestListProducesDeterministicOutput(t *testing.T) { } func TestListCanProduceEmptyShard(t *testing.T) { + t.Parallel() input := "pkg/a\npkg/b\n" foundEmpty := false for shardIndex := range 10 { @@ -108,6 +117,7 @@ func TestListCanProduceEmptyShard(t *testing.T) { } func TestListAndVerifyAgreeOnPartition(t *testing.T) { + t.Parallel() inputPackages := []string{ "pkg/a", "pkg/b", @@ -141,6 +151,7 @@ func TestListAndVerifyAgreeOnPartition(t *testing.T) { } func TestVerifyAllowsEmptyShard(t *testing.T) { + t.Parallel() var stdout bytes.Buffer err := run([]string{"verify", "--shard-count", "10"}, strings.NewReader("pkg/a\npkg/b\n"), &stdout) if err != nil { @@ -152,6 +163,7 @@ func TestVerifyAllowsEmptyShard(t *testing.T) { } func TestVerifyWithSingleShardCoversEntireInput(t *testing.T) { + t.Parallel() var stdout bytes.Buffer err := run([]string{"verify", "--shard-count", "1"}, strings.NewReader("pkg/a\npkg/b\npkg/c\n"), &stdout) if err != nil { @@ -168,6 +180,7 @@ func TestVerifyWithSingleShardCoversEntireInput(t *testing.T) { } func TestVerifyRejectsDuplicatePaths(t *testing.T) { + t.Parallel() var stdout bytes.Buffer err := run([]string{"verify", "--shard-count", "2"}, strings.NewReader("pkg/a\npkg/a\n"), &stdout) if err == nil || !strings.Contains(err.Error(), `duplicate package path "pkg/a"`) { @@ -176,6 +189,7 @@ func TestVerifyRejectsDuplicatePaths(t *testing.T) { } func TestVerifyRejectsDuplicatePathsAmongOthers(t *testing.T) { + t.Parallel() var stdout bytes.Buffer err := run([]string{"verify", "--shard-count", "2"}, strings.NewReader("pkg/a\npkg/b\npkg/c\npkg/d\npkg/e\npkg/a\n"), &stdout) if err == nil || !strings.Contains(err.Error(), `duplicate package path "pkg/a"`) { @@ -184,6 +198,7 @@ func TestVerifyRejectsDuplicatePathsAmongOthers(t *testing.T) { } func TestInvalidShardParamsFail(t *testing.T) { + t.Parallel() tests := []struct { name string args []string @@ -195,6 +210,7 @@ func TestInvalidShardParamsFail(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { + t.Parallel() err := run(tc.args, strings.NewReader("pkg/a\n"), &bytes.Buffer{}) if err == nil { t.Fatal("expected error") @@ -204,6 +220,7 @@ func TestInvalidShardParamsFail(t *testing.T) { } func TestUnknownSubcommandFails(t *testing.T) { + t.Parallel() err := run([]string{"wat"}, strings.NewReader("pkg/a\n"), &bytes.Buffer{}) if err == nil || !strings.Contains(err.Error(), `unknown subcommand "wat"`) { t.Fatalf("expected unknown subcommand error, got %v", err) @@ -211,6 +228,7 @@ func TestUnknownSubcommandFails(t *testing.T) { } func TestExtraPositionalArgsFail(t *testing.T) { + t.Parallel() tests := []struct { name string args []string @@ -222,6 +240,7 @@ func TestExtraPositionalArgsFail(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { + t.Parallel() err := run(tc.args, strings.NewReader("pkg/a\n"), &bytes.Buffer{}) if err == nil || !strings.Contains(err.Error(), tc.want) { t.Fatalf("expected %q, got %v", tc.want, err) @@ -231,6 +250,7 @@ func TestExtraPositionalArgsFail(t *testing.T) { } func TestLargePackageListParses(t *testing.T) { + t.Parallel() var builder strings.Builder for i := range 500 { fmt.Fprintf(&builder, "pkg/%03d\n", i) diff --git a/tools/gomod-local-update/internal/updater/config_test.go b/tools/gomod-local-update/internal/updater/config_test.go index 21b867aea8d..923f31dbdcc 100644 --- a/tools/gomod-local-update/internal/updater/config_test.go +++ b/tools/gomod-local-update/internal/updater/config_test.go @@ -6,6 +6,7 @@ import ( ) func TestConfig_Validate(t *testing.T) { + t.Parallel() tests := []struct { name string config *Config @@ -88,6 +89,7 @@ func TestConfig_Validate(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := tt.config.Validate() if (err != nil) != tt.wantErr { t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr) @@ -97,6 +99,7 @@ func TestConfig_Validate(t *testing.T) { } func TestConfig_ValidateErrorType(t *testing.T) { + t.Parallel() cfg := &Config{ RepoRemote: "invalid*remote", BranchTrunk: "develop", @@ -116,6 +119,7 @@ func TestConfig_ValidateErrorType(t *testing.T) { } func TestParseFlags(t *testing.T) { + t.Parallel() tests := []struct { name string args []string @@ -154,6 +158,7 @@ func TestParseFlags(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() got, err := ParseFlags(tt.args, "test-version") if (err != nil) != tt.wantErr { t.Errorf("ParseFlags() error = %v, wantErr %v", err, tt.wantErr) diff --git a/tools/gomod-local-update/internal/updater/updater_test.go b/tools/gomod-local-update/internal/updater/updater_test.go index ba17024dd37..af9f23044f7 100644 --- a/tools/gomod-local-update/internal/updater/updater_test.go +++ b/tools/gomod-local-update/internal/updater/updater_test.go @@ -75,6 +75,7 @@ func (m *mockSystemOperator) WriteFile(path string, data []byte, perm os.FileMod } func TestUpdater_Run(t *testing.T) { + t.Parallel() testTime := time.Date(2024, 11, 22, 18, 21, 10, 0, time.UTC) // Use a full 40-character SHA testSHA := "ac7a7395feed" + strings.Repeat("0", 28) @@ -249,6 +250,7 @@ replace github.com/smartcontractkit/chainlink/v3 => ../ for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() u := New(tt.config, tt.sysOp) // Add local replace directive for modules that should be updated @@ -286,6 +288,7 @@ replace github.com/smartcontractkit/chainlink/v3 => ../ } func TestUpdater_FindLocalReplaceModules(t *testing.T) { + t.Parallel() sysOp := newMockSystemOperator() sysOp.files["go.mod"] = []byte(` module test diff --git a/tools/plugout/main_test.go b/tools/plugout/main_test.go index ac039bcddd7..6ba82f6fa68 100644 --- a/tools/plugout/main_test.go +++ b/tools/plugout/main_test.go @@ -62,6 +62,7 @@ func yamlMissingGitRefFor(module string) string { // ----------------------------- func TestContains(t *testing.T) { + t.Parallel() if !contains([]string{"a", "b"}, "a") { t.Fatal("expected contains to find element") } @@ -71,6 +72,7 @@ func TestContains(t *testing.T) { } func TestModuleSubdir(t *testing.T) { + t.Parallel() cases := map[string]string{ "github.com/org/repo": "", "github.com/org/repo/relayer": "relayer", @@ -89,6 +91,7 @@ func TestModuleSubdir(t *testing.T) { } func TestShaEqual(t *testing.T) { + t.Parallel() cases := []struct { a, b string want bool @@ -108,7 +111,9 @@ func TestShaEqual(t *testing.T) { } func TestNormalizeVersion(t *testing.T) { + t.Parallel() t.Run("plain tag", func(t *testing.T) { + t.Parallel() mv := normalizeVersion("v1.2.3") if mv.Tag != "v1.2.3" || mv.SHA != "" || mv.TagPrefix != "" || mv.Raw != "v1.2.3" { t.Fatalf("unexpected mv: %+v", mv) @@ -116,6 +121,7 @@ func TestNormalizeVersion(t *testing.T) { }) t.Run("prefixed tag", func(t *testing.T) { + t.Parallel() mv := normalizeVersion("sub/dir/v1.2.3") if mv.Raw != "sub/dir/v1.2.3" || mv.Tag != "v1.2.3" || mv.TagPrefix != "sub/dir" || mv.SHA != "" { t.Fatalf("unexpected mv: %+v", mv) @@ -123,6 +129,7 @@ func TestNormalizeVersion(t *testing.T) { }) t.Run("pseudo with sha (go style)", func(t *testing.T) { + t.Parallel() valids := []string{ "v0.0.0-20251013133428-62ab1091a563", "v1.2.3-0.20250102030405-abcdef123456", @@ -137,6 +144,7 @@ func TestNormalizeVersion(t *testing.T) { }) t.Run("bad pseudos should not match", func(t *testing.T) { + t.Parallel() invalids := []string{ "v1.2.3--20240102030405-deadbeef", // extra hyphen "v1.2.3-20240102030405g-deadbeef", // junk in timestamp @@ -152,6 +160,7 @@ func TestNormalizeVersion(t *testing.T) { }) t.Run("raw sha", func(t *testing.T) { + t.Parallel() mv := normalizeVersion("abcdef1234567890") if mv.SHA != "abcdef1234567890" || mv.Tag != "" || mv.Raw != "abcdef1234567890" { t.Fatalf("unexpected mv: %+v", mv) @@ -160,6 +169,7 @@ func TestNormalizeVersion(t *testing.T) { } func TestDesiredYAMLRefForModule(t *testing.T) { + t.Parallel() cases := []struct { module string mv ModuleVersion @@ -182,7 +192,10 @@ func TestDesiredYAMLRefForModule(t *testing.T) { } func TestTagsMatchWithSubdir(t *testing.T) { + t.Parallel( // root modules: tag equality only + ) + if !tagsMatchWithSubdir("github.com/example/repo", ModuleVersion{Tag: "v1.2.3", Raw: "v1.2.3"}, ModuleVersion{Tag: "v1.2.3", Raw: "v1.2.3"}) { @@ -219,9 +232,11 @@ func TestTagsMatchWithSubdir(t *testing.T) { } func TestVersionsMatchForModule(t *testing.T) { + t.Parallel() module := "github.com/example/repo/sub" t.Run("SHA equality (prefix)", func(t *testing.T) { + t.Parallel() a := ModuleVersion{SHA: "abcdef1234", Raw: "v0.0.0-...-abcdef1234"} b := ModuleVersion{SHA: "abcdef", Raw: "abcdef"} if !versionsMatchForModule(module, a, b) { @@ -230,6 +245,7 @@ func TestVersionsMatchForModule(t *testing.T) { }) t.Run("YAML raw contains go.mod SHA", func(t *testing.T) { + t.Parallel() a := ModuleVersion{SHA: "deadbeef", Raw: "v0.0.0-...-deadbeef"} b := ModuleVersion{Raw: "v0.0.0-20250102030405-deadbeef"} if !versionsMatchForModule(module, a, b) { @@ -238,6 +254,7 @@ func TestVersionsMatchForModule(t *testing.T) { }) t.Run("Tag with subdir equivalence", func(t *testing.T) { + t.Parallel() a := ModuleVersion{Tag: "v1.2.3", Raw: "v1.2.3"} b := ModuleVersion{Raw: "sub/v1.2.3"} if !versionsMatchForModule(module, a, b) { @@ -246,6 +263,7 @@ func TestVersionsMatchForModule(t *testing.T) { }) t.Run("Raw equality fallback", func(t *testing.T) { + t.Parallel() a := ModuleVersion{Raw: "weird-form-1"} b := ModuleVersion{Raw: "weird-form-1"} if !versionsMatchForModule(module, a, b) { @@ -259,6 +277,7 @@ func TestVersionsMatchForModule(t *testing.T) { // ----------------------------- func TestDiscoverPluginVersions(t *testing.T) { + t.Parallel() dir := t.TempDir() yamlPath := writeFile(t, dir, "plugins.yaml", samplePluginsYAML()) @@ -278,6 +297,7 @@ func TestDiscoverPluginVersions(t *testing.T) { } func TestUpdateGitRefInYAML_SuccessAndPreserveFormatting(t *testing.T) { + t.Parallel() dir := t.TempDir() yamlPath := writeFile(t, dir, "plugins.yaml", samplePluginsYAML()) @@ -305,6 +325,7 @@ func TestUpdateGitRefInYAML_SuccessAndPreserveFormatting(t *testing.T) { } func TestUpdateGitRefInYAML_ModuleNotFound(t *testing.T) { + t.Parallel() dir := t.TempDir() yamlPath := writeFile(t, dir, "plugins.yaml", samplePluginsYAML()) err := updateGitRefInYAML(yamlPath, "github.com/does/not/exist", ModuleVersion{Tag: "v0.1.0", Raw: "exist/v0.1.0"}) @@ -314,6 +335,7 @@ func TestUpdateGitRefInYAML_ModuleNotFound(t *testing.T) { } func TestUpdateGitRefInYAML_NoGitRefLineToReplace(t *testing.T) { + t.Parallel() dir := t.TempDir() mod := "github.com/example/repo" yamlPath := writeFile(t, dir, "plugins.yaml", yamlMissingGitRefFor(mod)) @@ -328,6 +350,7 @@ func TestUpdateGitRefInYAML_NoGitRefLineToReplace(t *testing.T) { // ----------------------------- func TestRunSync_CheckMode_WithMismatch(t *testing.T) { + t.Parallel() dir := t.TempDir() // go.mod only needs to exist goMod := writeFile(t, dir, "go.mod", "module github.com/example/repo\n") @@ -363,6 +386,7 @@ func TestRunSync_CheckMode_WithMismatch(t *testing.T) { } func TestRunSync_UpdateMode_AppliesChanges(t *testing.T) { + t.Parallel() dir := t.TempDir() goMod := writeFile(t, dir, "go.mod", "module github.com/example/repo\n") plugins := writeFile(t, dir, "plugins.yaml", samplePluginsYAML()) @@ -404,6 +428,7 @@ func TestRunSync_UpdateMode_AppliesChanges(t *testing.T) { } func TestRunSync_IgnoreModules_SkipsChecks(t *testing.T) { + t.Parallel() dir := t.TempDir() goMod := writeFile(t, dir, "go.mod", "module github.com/example/repo\n") plugins := writeFile(t, dir, "plugins.yaml", samplePluginsYAML()) @@ -430,10 +455,12 @@ func TestRunSync_IgnoreModules_SkipsChecks(t *testing.T) { } func TestRunSync_SkipsIndirectDependencies(t *testing.T) { + t.Parallel() dir := t.TempDir() goMod := writeFile(t, dir, "go.mod", "module github.com/example/repo\n") t.Run("CheckMode_NoMismatch", func(t *testing.T) { + t.Parallel() plugins := writeFile(t, dir, "plugins-check.yaml", samplePluginsYAML()) opts := Options{ GoModPath: goMod, @@ -455,6 +482,7 @@ func TestRunSync_SkipsIndirectDependencies(t *testing.T) { }) t.Run("UpdateMode_LeavesFileUnchanged", func(t *testing.T) { + t.Parallel() plugins := writeFile(t, dir, "plugins-update.yaml", samplePluginsYAML()) before := readFile(t, plugins) opts := Options{ @@ -475,6 +503,7 @@ func TestRunSync_SkipsIndirectDependencies(t *testing.T) { } func TestRunSync_FileValidation(t *testing.T) { + t.Parallel() dir := t.TempDir() // Missing go.mod _, err := runSync(Options{ From a2d354de9c6ecf7d0a3ef2587b9efe864ad00e08 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Wed, 11 Nov 2026 16:53:04 -0500 Subject: [PATCH 2/3] test: add t.Parallel to wave 3 config and ocrcommon tests core/services/chainlink: 98 sites, almost all pure config parsing. core/services/ocrcommon: 38 sites. Three cases stay sequential: - Test_InMemoryDataSourceWithProm asserts on process-global Prometheus counters, so it keeps a nolint. - Test_DiscovererDatabase subtests read rows written by earlier subtests. - Test_SingletonPeerWrapper_Start subtests now build their own keystore and DB handle instead of sharing one, so they can run in parallel. --- .../chainlink/config_audit_logger_test.go | 1 + .../chainlink/config_auto_pprof_test.go | 1 + .../chainlink/config_capabilities_test.go | 8 ++++ core/services/chainlink/config_ccv_test.go | 1 + core/services/chainlink/config_cre_test.go | 5 +++ .../chainlink/config_database_test.go | 1 + .../services/chainlink/config_feature_test.go | 1 + .../chainlink/config_general_dev_test.go | 3 ++ .../chainlink/config_insecure_test.go | 1 + .../chainlink/config_job_distributor_test.go | 1 + .../chainlink/config_job_pipeline_test.go | 1 + core/services/chainlink/config_log_test.go | 1 + .../services/chainlink/config_mercury_test.go | 2 + core/services/chainlink/config_ocr2_test.go | 1 + core/services/chainlink/config_ocr_test.go | 1 + core/services/chainlink/config_p2p_test.go | 1 + .../chainlink/config_password_test.go | 1 + .../chainlink/config_prometheus_test.go | 1 + .../chainlink/config_pyroscope_test.go | 1 + .../config_telemetry_ingress_test.go | 4 ++ .../chainlink/config_telemetry_test.go | 38 +++++++++++++++++++ core/services/chainlink/config_test.go | 17 +++++++++ .../chainlink/config_threshold_test.go | 1 + .../services/chainlink/config_tracing_test.go | 2 + .../chainlink/config_web_server_test.go | 1 + .../chainlink/config_workflows_test.go | 1 + core/services/chainlink/heartbeat_test.go | 2 + core/services/chainlink/node_platform_test.go | 1 + core/services/ocrcommon/adapters_test.go | 5 +++ core/services/ocrcommon/data_source_test.go | 8 ++++ .../ocrcommon/discoverer_database_test.go | 3 +- core/services/ocrcommon/peer_wrapper_test.go | 12 +++++- core/services/ocrcommon/run_saver_test.go | 1 + core/services/ocrcommon/telemetry_test.go | 17 +++++++++ 34 files changed, 143 insertions(+), 3 deletions(-) diff --git a/core/services/chainlink/config_audit_logger_test.go b/core/services/chainlink/config_audit_logger_test.go index 91e5dced5c0..a63d43ec2ff 100644 --- a/core/services/chainlink/config_audit_logger_test.go +++ b/core/services/chainlink/config_audit_logger_test.go @@ -7,6 +7,7 @@ import ( ) func TestAuditLoggerConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_auto_pprof_test.go b/core/services/chainlink/config_auto_pprof_test.go index ac3024c27db..ad6aabc79fe 100644 --- a/core/services/chainlink/config_auto_pprof_test.go +++ b/core/services/chainlink/config_auto_pprof_test.go @@ -11,6 +11,7 @@ import ( ) func TestAutoPprofTest(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_capabilities_test.go b/core/services/chainlink/config_capabilities_test.go index 3b0317927e5..6143ab6b539 100644 --- a/core/services/chainlink/config_capabilities_test.go +++ b/core/services/chainlink/config_capabilities_test.go @@ -10,6 +10,7 @@ import ( ) func TestCapabilitiesLocalConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } @@ -31,6 +32,7 @@ func TestCapabilitiesLocalConfig(t *testing.T) { } func TestCapabilitiesLocalConfigEmpty(t *testing.T) { + t.Parallel() tomlStr := ` [Capabilities.Local] ` @@ -46,6 +48,7 @@ func TestCapabilitiesLocalConfigEmpty(t *testing.T) { } func TestValidateCapabilityID(t *testing.T) { + t.Parallel() tests := []struct { name string capID string @@ -66,6 +69,7 @@ func TestValidateCapabilityID(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := toml.ValidateCapabilityID(tt.capID) if tt.wantErr { assert.Error(t, err) @@ -77,7 +81,9 @@ func TestValidateCapabilityID(t *testing.T) { } func TestLocalCapabilitiesValidation(t *testing.T) { + t.Parallel() t.Run("valid config with regex patterns", func(t *testing.T) { + t.Parallel() cfg := toml.LocalCapabilities{ RegistryBasedLaunchAllowlist: []string{"^cron@1\\.0\\.0$", "^http-actions@.*$", ".*"}, } @@ -86,6 +92,7 @@ func TestLocalCapabilitiesValidation(t *testing.T) { }) t.Run("invalid regex pattern", func(t *testing.T) { + t.Parallel() cfg := toml.LocalCapabilities{ RegistryBasedLaunchAllowlist: []string{"[invalid"}, } @@ -96,6 +103,7 @@ func TestLocalCapabilitiesValidation(t *testing.T) { }) t.Run("multiple errors", func(t *testing.T) { + t.Parallel() cfg := toml.LocalCapabilities{ RegistryBasedLaunchAllowlist: []string{"[invalid1", "[invalid2"}, } diff --git a/core/services/chainlink/config_ccv_test.go b/core/services/chainlink/config_ccv_test.go index 342f2476bf7..eac117e8837 100644 --- a/core/services/chainlink/config_ccv_test.go +++ b/core/services/chainlink/config_ccv_test.go @@ -25,6 +25,7 @@ APISecret = "indexer-api-secret" ) func TestCCVConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ SecretsStrings: []string{secretsCCV}, } diff --git a/core/services/chainlink/config_cre_test.go b/core/services/chainlink/config_cre_test.go index ad4a567e24e..c553b45a68f 100644 --- a/core/services/chainlink/config_cre_test.go +++ b/core/services/chainlink/config_cre_test.go @@ -35,6 +35,7 @@ URL = "file:///path/to/workflows" ) func TestCREConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ SecretsStrings: []string{secretsCRE}, ConfigStrings: []string{configCRE}, @@ -57,6 +58,7 @@ func TestCREConfig(t *testing.T) { } func TestCREConfigWithFileURL(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{configCREWithFileURL}, } @@ -71,6 +73,7 @@ func TestCREConfigWithFileURL(t *testing.T) { } func TestEmptyCREConfig(t *testing.T) { + t.Parallel() cfg := creConfig{s: toml.CreSecrets{}, c: toml.CreConfig{}} assert.Empty(t, cfg.StreamsAPIKey()) assert.Empty(t, cfg.StreamsAPISecret()) @@ -85,6 +88,7 @@ func TestEmptyCREConfig(t *testing.T) { } func TestWorkflowFetcherConfig(t *testing.T) { + t.Parallel() testCases := []struct { name string config string @@ -118,6 +122,7 @@ URL = "file:///local/path/to/workflows" for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{tc.config}, } diff --git a/core/services/chainlink/config_database_test.go b/core/services/chainlink/config_database_test.go index b3aed7e18c6..ebd5b77a56e 100644 --- a/core/services/chainlink/config_database_test.go +++ b/core/services/chainlink/config_database_test.go @@ -12,6 +12,7 @@ import ( ) func TestDatabaseConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, SecretsStrings: []string{`[Database] diff --git a/core/services/chainlink/config_feature_test.go b/core/services/chainlink/config_feature_test.go index 8fa5884450a..4fade6b5cbc 100644 --- a/core/services/chainlink/config_feature_test.go +++ b/core/services/chainlink/config_feature_test.go @@ -8,6 +8,7 @@ import ( ) func TestFeatureConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_general_dev_test.go b/core/services/chainlink/config_general_dev_test.go index 75ebf5bfac1..8db510dd736 100644 --- a/core/services/chainlink/config_general_dev_test.go +++ b/core/services/chainlink/config_general_dev_test.go @@ -16,6 +16,7 @@ func TestTOMLGeneralConfig_DevModeInsecureConfig(t *testing.T) { t.Parallel() t.Run("all insecure configs are false by default", func(t *testing.T) { + t.Parallel() config, err := GeneralConfigOpts{}.New() require.NoError(t, err) @@ -26,6 +27,7 @@ func TestTOMLGeneralConfig_DevModeInsecureConfig(t *testing.T) { }) t.Run("insecure config ignore override on non-dev builds", func(t *testing.T) { + t.Parallel() config, err := GeneralConfigOpts{ OverrideFn: func(c *Config, s *Secrets) { *c.Insecure.DevWebServer = true @@ -43,6 +45,7 @@ func TestTOMLGeneralConfig_DevModeInsecureConfig(t *testing.T) { }) t.Run("ParseConfig accepts insecure values on dev builds", func(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{ ` diff --git a/core/services/chainlink/config_insecure_test.go b/core/services/chainlink/config_insecure_test.go index 72f1cf28bb8..aa483bae14a 100644 --- a/core/services/chainlink/config_insecure_test.go +++ b/core/services/chainlink/config_insecure_test.go @@ -8,6 +8,7 @@ import ( ) func TestInsecureConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_job_distributor_test.go b/core/services/chainlink/config_job_distributor_test.go index 423b3b4ca00..f1ff34b1189 100644 --- a/core/services/chainlink/config_job_distributor_test.go +++ b/core/services/chainlink/config_job_distributor_test.go @@ -8,6 +8,7 @@ import ( ) func TestJobDistributorConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_job_pipeline_test.go b/core/services/chainlink/config_job_pipeline_test.go index 9a865569eb3..f997a48d20e 100644 --- a/core/services/chainlink/config_job_pipeline_test.go +++ b/core/services/chainlink/config_job_pipeline_test.go @@ -12,6 +12,7 @@ import ( ) func TestJobPipelineConfigTest(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_log_test.go b/core/services/chainlink/config_log_test.go index bc5828a2056..7b65a1cf90f 100644 --- a/core/services/chainlink/config_log_test.go +++ b/core/services/chainlink/config_log_test.go @@ -11,6 +11,7 @@ import ( ) func TestLogConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_mercury_test.go b/core/services/chainlink/config_mercury_test.go index 6b2016e46f7..aaf5eedf2f5 100644 --- a/core/services/chainlink/config_mercury_test.go +++ b/core/services/chainlink/config_mercury_test.go @@ -25,6 +25,7 @@ Password = "password2" ) func TestMercuryConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ SecretsStrings: []string{secretsMercury}, } @@ -37,6 +38,7 @@ func TestMercuryConfig(t *testing.T) { } func TestMercuryTLS(t *testing.T) { + t.Parallel() certPath := "/path/to/cert.pem" transmission := toml.Mercury{ TLS: toml.MercuryTLS{ diff --git a/core/services/chainlink/config_ocr2_test.go b/core/services/chainlink/config_ocr2_test.go index 21b057a8a4d..40fae622b71 100644 --- a/core/services/chainlink/config_ocr2_test.go +++ b/core/services/chainlink/config_ocr2_test.go @@ -8,6 +8,7 @@ import ( ) func TestOCR2Config(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_ocr_test.go b/core/services/chainlink/config_ocr_test.go index 0a3038f1d34..c21519e0658 100644 --- a/core/services/chainlink/config_ocr_test.go +++ b/core/services/chainlink/config_ocr_test.go @@ -8,6 +8,7 @@ import ( ) func TestOCRConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_p2p_test.go b/core/services/chainlink/config_p2p_test.go index 12ee01b85d7..bf432e9a5a0 100644 --- a/core/services/chainlink/config_p2p_test.go +++ b/core/services/chainlink/config_p2p_test.go @@ -11,6 +11,7 @@ import ( ) func TestP2PConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_password_test.go b/core/services/chainlink/config_password_test.go index fddcea0936b..c74ce90bb56 100644 --- a/core/services/chainlink/config_password_test.go +++ b/core/services/chainlink/config_password_test.go @@ -8,6 +8,7 @@ import ( ) func TestPasswordConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_prometheus_test.go b/core/services/chainlink/config_prometheus_test.go index 654a07e1824..fea703967f3 100644 --- a/core/services/chainlink/config_prometheus_test.go +++ b/core/services/chainlink/config_prometheus_test.go @@ -8,6 +8,7 @@ import ( ) func TestPrometheusConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_pyroscope_test.go b/core/services/chainlink/config_pyroscope_test.go index 9e12ae76408..36e76120559 100644 --- a/core/services/chainlink/config_pyroscope_test.go +++ b/core/services/chainlink/config_pyroscope_test.go @@ -7,6 +7,7 @@ import ( ) func TestPyroscopeConfigTest(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, SecretsStrings: []string{secretsFullTOML}, diff --git a/core/services/chainlink/config_telemetry_ingress_test.go b/core/services/chainlink/config_telemetry_ingress_test.go index 2bcdf3c80b1..dae8a7033e8 100644 --- a/core/services/chainlink/config_telemetry_ingress_test.go +++ b/core/services/chainlink/config_telemetry_ingress_test.go @@ -11,6 +11,7 @@ import ( ) func TestTelemetryIngressConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } @@ -36,7 +37,9 @@ func TestTelemetryIngressConfig(t *testing.T) { } func TestTelemetryIngressConfig_ChipIngressEnabled(t *testing.T) { + t.Parallel() t.Run("returns false when ChipIngressEnabled is explicitly false", func(t *testing.T) { + t.Parallel() falseVal := false config := &telemetryIngressConfig{ c: toml.TelemetryIngress{ @@ -47,6 +50,7 @@ func TestTelemetryIngressConfig_ChipIngressEnabled(t *testing.T) { }) t.Run("returns true when ChipIngressEnabled is true", func(t *testing.T) { + t.Parallel() trueVal := true config := &telemetryIngressConfig{ c: toml.TelemetryIngress{ diff --git a/core/services/chainlink/config_telemetry_test.go b/core/services/chainlink/config_telemetry_test.go index 94b25466db3..ccbe020b4e6 100644 --- a/core/services/chainlink/config_telemetry_test.go +++ b/core/services/chainlink/config_telemetry_test.go @@ -14,6 +14,7 @@ import ( ) func TestTelemetryConfig_Enabled(t *testing.T) { + t.Parallel() trueVal := true falseVal := false @@ -28,6 +29,7 @@ func TestTelemetryConfig_Enabled(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.Enabled()) }) @@ -35,6 +37,7 @@ func TestTelemetryConfig_Enabled(t *testing.T) { } func TestTelemetryConfig_InsecureConnection(t *testing.T) { + t.Parallel() trueVal := true falseVal := false @@ -49,6 +52,7 @@ func TestTelemetryConfig_InsecureConnection(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.InsecureConnection()) }) @@ -56,6 +60,7 @@ func TestTelemetryConfig_InsecureConnection(t *testing.T) { } func TestTelemetryConfig_CACertFile(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -67,6 +72,7 @@ func TestTelemetryConfig_CACertFile(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.CACertFile()) }) @@ -74,6 +80,7 @@ func TestTelemetryConfig_CACertFile(t *testing.T) { } func TestTelemetryConfig_OtelExporterGRPCEndpoint(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -85,6 +92,7 @@ func TestTelemetryConfig_OtelExporterGRPCEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.OtelExporterGRPCEndpoint()) }) @@ -92,6 +100,7 @@ func TestTelemetryConfig_OtelExporterGRPCEndpoint(t *testing.T) { } func TestTelemetryConfig_ResourceAttributes(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -122,6 +131,7 @@ func TestTelemetryConfig_ResourceAttributes(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.ResourceAttributes()) }) @@ -151,6 +161,7 @@ func TestTelemetryConfig_ResourceAttributesShardIndex(t *testing.T) { } func TestTelemetryConfig_TraceSampleRatio(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -161,6 +172,7 @@ func TestTelemetryConfig_TraceSampleRatio(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.InEpsilon(t, tt.expected, tc.TraceSampleRatio(), 0.0001) }) @@ -168,6 +180,7 @@ func TestTelemetryConfig_TraceSampleRatio(t *testing.T) { } func TestTelemetryConfig_EmitterBatchProcessor(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -179,6 +192,7 @@ func TestTelemetryConfig_EmitterBatchProcessor(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.EmitterBatchProcessor()) }) @@ -186,6 +200,7 @@ func TestTelemetryConfig_EmitterBatchProcessor(t *testing.T) { } func TestTelemetryConfig_EmitterExportTimeout(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -198,6 +213,7 @@ func TestTelemetryConfig_EmitterExportTimeout(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.EmitterExportTimeout()) }) @@ -205,6 +221,7 @@ func TestTelemetryConfig_EmitterExportTimeout(t *testing.T) { } func TestTelemetryConfig_ChipIngressEndpoint(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -217,6 +234,7 @@ func TestTelemetryConfig_ChipIngressEndpoint(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.ChipIngressEndpoint()) }) @@ -224,6 +242,7 @@ func TestTelemetryConfig_ChipIngressEndpoint(t *testing.T) { } func TestTelemetryConfig_ChipIngressInsecureConnection(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -235,6 +254,7 @@ func TestTelemetryConfig_ChipIngressInsecureConnection(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.ChipIngressInsecureConnection()) }) @@ -242,6 +262,7 @@ func TestTelemetryConfig_ChipIngressInsecureConnection(t *testing.T) { } func TestTelemetryConfig_ChipIngressBatchEmitterEnabled(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -254,6 +275,7 @@ func TestTelemetryConfig_ChipIngressBatchEmitterEnabled(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.ChipIngressBatchEmitterEnabled()) }) @@ -427,6 +449,7 @@ func TestTelemetryConfig_ChipIngressMaxGRPCRequestSize(t *testing.T) { } func TestTelemetryConfig_HeartbeatInterval(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -439,6 +462,7 @@ func TestTelemetryConfig_HeartbeatInterval(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.HeartbeatInterval()) }) @@ -446,6 +470,7 @@ func TestTelemetryConfig_HeartbeatInterval(t *testing.T) { } func TestTelemetryConfig_LogStreamingEnabled(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -457,6 +482,7 @@ func TestTelemetryConfig_LogStreamingEnabled(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogStreamingEnabled()) }) @@ -464,6 +490,7 @@ func TestTelemetryConfig_LogStreamingEnabled(t *testing.T) { } func TestTelemetryConfig_LogLevel(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -479,6 +506,7 @@ func TestTelemetryConfig_LogLevel(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogLevel()) }) @@ -486,6 +514,7 @@ func TestTelemetryConfig_LogLevel(t *testing.T) { } func TestTelemetryConfig_LogBatchProcessor(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -498,6 +527,7 @@ func TestTelemetryConfig_LogBatchProcessor(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogBatchProcessor()) }) @@ -505,6 +535,7 @@ func TestTelemetryConfig_LogBatchProcessor(t *testing.T) { } func TestTelemetryConfig_LogExportTimeout(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -516,6 +547,7 @@ func TestTelemetryConfig_LogExportTimeout(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogExportTimeout()) }) @@ -523,6 +555,7 @@ func TestTelemetryConfig_LogExportTimeout(t *testing.T) { } func TestTelemetryConfig_LogExportMaxBatchSize(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -534,6 +567,7 @@ func TestTelemetryConfig_LogExportMaxBatchSize(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogExportMaxBatchSize()) }) @@ -541,6 +575,7 @@ func TestTelemetryConfig_LogExportMaxBatchSize(t *testing.T) { } func TestTelemetryConfig_LogExportInterval(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -552,6 +587,7 @@ func TestTelemetryConfig_LogExportInterval(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogExportInterval()) }) @@ -559,6 +595,7 @@ func TestTelemetryConfig_LogExportInterval(t *testing.T) { } func TestTelemetryConfig_LogMaxQueueSize(t *testing.T) { + t.Parallel() tests := []struct { name string telemetry toml.Telemetry @@ -570,6 +607,7 @@ func TestTelemetryConfig_LogMaxQueueSize(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() tc := telemetryConfig{s: tt.telemetry} assert.Equal(t, tt.expected, tc.LogMaxQueueSize()) }) diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 0d9219aa82b..5e0b318213a 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -152,6 +152,7 @@ var ( ) func TestConfig_Marshal(t *testing.T) { + t.Parallel() zeroSeconds := *commonconfig.MustNewDuration(time.Second * 0) second := *commonconfig.MustNewDuration(time.Second) minute := *commonconfig.MustNewDuration(time.Minute) @@ -1279,6 +1280,7 @@ ReaperMaxAge = '678h0m0s' {"multi-chain", multiChain, multiChainTOML}, } { t.Run(tt.name, func(t *testing.T) { + t.Parallel() s, err := tt.config.TOMLString() require.NoError(t, err) assert.Equal(t, tt.exp, s, diff.Diff(tt.exp, s)) @@ -1295,6 +1297,7 @@ ReaperMaxAge = '678h0m0s' } func TestConfig_full(t *testing.T) { + t.Parallel() var got Config require.NoError(t, commonconfig.DecodeTOML(strings.NewReader(fullTOML), &got)) // Except for some EVM node fields. @@ -1385,6 +1388,7 @@ func TestConfig_full(t *testing.T) { var invalidTOML string func TestConfig_Validate(t *testing.T) { + t.Parallel() for _, tt := range []struct { name string toml string @@ -1488,6 +1492,7 @@ func TestConfig_Validate(t *testing.T) { - ChainID: missing: required for all chains`}, } { t.Run(tt.name, func(t *testing.T) { + t.Parallel() var c Config require.NoError(t, commonconfig.DecodeTOML(strings.NewReader(tt.toml), &c)) c.setDefaults() @@ -1532,6 +1537,7 @@ var ( ) func Test_generalConfig_LogConfiguration(t *testing.T) { + t.Parallel() const ( secrets = "# Secrets:\n" input = "# Input Configuration:\n" @@ -1562,6 +1568,7 @@ func Test_generalConfig_LogConfiguration(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() lggr, observed := logger.TestLoggerObserved(t, zapcore.InfoLevel) opts := GeneralConfigOpts{ SkipEnv: true, @@ -1608,6 +1615,7 @@ func Test_generalConfig_LogConfiguration(t *testing.T) { } func TestNewGeneralConfig_ParsingError_InvalidSyntax(t *testing.T) { + t.Parallel() invalidTOML := "{ bad syntax {" opts := GeneralConfigOpts{ ConfigStrings: []string{invalidTOML}, @@ -1618,6 +1626,7 @@ func TestNewGeneralConfig_ParsingError_InvalidSyntax(t *testing.T) { } func TestNewGeneralConfig_ParsingError_DuplicateField(t *testing.T) { + t.Parallel() invalidTOML := `Dev = false Dev = true` opts := GeneralConfigOpts{ @@ -1649,6 +1658,7 @@ func TestNewGeneralConfig_SecretsOverrides(t *testing.T) { } func TestSecrets_Validate(t *testing.T) { + t.Parallel() for _, tt := range []struct { name string toml string @@ -1703,6 +1713,7 @@ AllowSimplePasswords = true`, }, } { t.Run(tt.name, func(t *testing.T) { + t.Parallel() var s Secrets require.NoError(t, commonconfig.DecodeTOML(strings.NewReader(tt.toml), &s)) assertValidationError(t, &s, tt.exp) @@ -1719,6 +1730,7 @@ func assertValidationError(t *testing.T, invalid interface{ Validate() error }, } func TestConfig_setDefaults(t *testing.T) { + t.Parallel() var c Config c.EVM = evmcfg.EVMConfigs{{ChainID: sqlutil.NewI(99999133712345)}} c.Solana = RawConfigs{{"ChainID": new("unknown solana chain")}} @@ -1762,6 +1774,7 @@ func TestConfig_SetFrom(t *testing.T) { {"multi-empty", multiChainTOML, []string{multiChainTOML, ""}}, } { t.Run(tt.name, func(t *testing.T) { + t.Parallel() var c Config for _, fs := range tt.from { var f Config @@ -1777,6 +1790,7 @@ func TestConfig_SetFrom(t *testing.T) { } func TestConfig_warnings(t *testing.T) { + t.Parallel() tests := []struct { name string config Config @@ -1804,6 +1818,7 @@ func TestConfig_warnings(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() err := tt.config.warnings() if len(tt.expectedErrors) == 0 { assert.NoError(t, err) @@ -1823,6 +1838,7 @@ func mustHexToBig(t *testing.T, hx string) *big.Int { } func TestRawConfig_IsEnabled(t *testing.T) { + t.Parallel() assert.True(t, RawConfig{"Enabled": true}.IsEnabled()) assert.True(t, RawConfig{"Enabled": nil}.IsEnabled()) assert.True(t, RawConfig{}.IsEnabled()) @@ -1832,6 +1848,7 @@ func TestRawConfig_IsEnabled(t *testing.T) { } func TestRawConfig_SetDefaults(t *testing.T) { + t.Parallel() c := RawConfig{"Enabled": true} c.SetDefaults() require.NotContains(t, c, "Enabled") diff --git a/core/services/chainlink/config_threshold_test.go b/core/services/chainlink/config_threshold_test.go index d847f65e3ed..b201c8ab1a2 100644 --- a/core/services/chainlink/config_threshold_test.go +++ b/core/services/chainlink/config_threshold_test.go @@ -15,6 +15,7 @@ ThresholdKeyShare = "something" ) func TestThresholdConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ SecretsStrings: []string{thresholdSecrets}, } diff --git a/core/services/chainlink/config_tracing_test.go b/core/services/chainlink/config_tracing_test.go index f0bf4290907..e519661e92e 100644 --- a/core/services/chainlink/config_tracing_test.go +++ b/core/services/chainlink/config_tracing_test.go @@ -9,6 +9,8 @@ import ( ) func TestTracing_Config(t *testing.T) { + t.Parallel() + // Test when all fields are non-nil enabled := true collectorTarget := "http://localhost:9000" diff --git a/core/services/chainlink/config_web_server_test.go b/core/services/chainlink/config_web_server_test.go index e4f5aba1d3d..ee6fbc085dd 100644 --- a/core/services/chainlink/config_web_server_test.go +++ b/core/services/chainlink/config_web_server_test.go @@ -11,6 +11,7 @@ import ( ) func TestWebServerConfig(t *testing.T) { + t.Parallel() opts := GeneralConfigOpts{ ConfigStrings: []string{fullTOML}, } diff --git a/core/services/chainlink/config_workflows_test.go b/core/services/chainlink/config_workflows_test.go index 6912b409b25..d2dfdf0f116 100644 --- a/core/services/chainlink/config_workflows_test.go +++ b/core/services/chainlink/config_workflows_test.go @@ -8,6 +8,7 @@ import ( ) func TestWorkflowsConfig(t *testing.T) { + t.Parallel() workflowsTOML := `[Workflows] [Workflows.Limits] Global = 200 diff --git a/core/services/chainlink/heartbeat_test.go b/core/services/chainlink/heartbeat_test.go index 8a50932b243..c842b94a24d 100644 --- a/core/services/chainlink/heartbeat_test.go +++ b/core/services/chainlink/heartbeat_test.go @@ -32,6 +32,8 @@ func TestNewHeartbeat_ConfiguresHeartbeatInterval(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() + // Create test logger lggr := logger.TestLogger(t) diff --git a/core/services/chainlink/node_platform_test.go b/core/services/chainlink/node_platform_test.go index ea2c5bf3563..6e560d2a31d 100644 --- a/core/services/chainlink/node_platform_test.go +++ b/core/services/chainlink/node_platform_test.go @@ -69,6 +69,7 @@ func eip55AddressPtr(raw string) *evmtypes.EIP55Address { } func TestNewNodePlatformBuildInfoConfig_UsesThreeMinuteBeat(t *testing.T) { + t.Parallel() csaStore := &keystoremocks.CSA{} keyStore := &keystoremocks.Master{} keyStore.EXPECT().CSA().Return(csaStore).Once() diff --git a/core/services/ocrcommon/adapters_test.go b/core/services/ocrcommon/adapters_test.go index 9378d8b0aff..eec0777b6f2 100644 --- a/core/services/ocrcommon/adapters_test.go +++ b/core/services/ocrcommon/adapters_test.go @@ -103,6 +103,7 @@ func (f fakeOnchainKeyring) MaxSignatureLength() int { } func TestOCR3OnchainKeyringAdapter(t *testing.T) { + t.Parallel() kr := ocrcommon.NewOCR3OnchainKeyringAdapter(fakeOnchainKeyring{}) _, err := kr.Sign(configDigest, seqNr, rwi) @@ -114,6 +115,7 @@ func TestOCR3OnchainKeyringAdapter(t *testing.T) { } func TestNewOCR3OnchainKeyringMultiChainAdapter(t *testing.T) { + t.Parallel() evmBundle, err := ocr2key.New(corekeys.EVM) require.NoError(t, err) @@ -210,6 +212,7 @@ func TestNewOCR3OnchainKeyringMultiChainAdapter_Stellar(t *testing.T) { } func TestOCR3OnchainKeyringMultiChainAdapter_Has(t *testing.T) { + t.Parallel() adapter := newMultichainAdapter(t) require.True(t, adapter.Has(adapter.PublicKey())) @@ -250,6 +253,7 @@ func newMultichainAdapter(t *testing.T) *ocrcommon.OCR3OnchainKeyringMultiChainA } func TestNewOCR3OnchainKeyringMultiChainAdapter_VerifyFromDifferentNodesPublicKeys(t *testing.T) { + t.Parallel() firstNodeAdapter := newMultichainAdapter(t) secondNodeAdapter := newMultichainAdapter(t) @@ -325,6 +329,7 @@ func (f fakeContractTransmitter) FromAccount(context.Context) (ocrtypes.Account, } func TestContractTransmitter(t *testing.T) { + t.Parallel() ctx := t.Context() ct := ocrcommon.NewOCR3ContractTransmitterAdapter(fakeContractTransmitter{}) diff --git a/core/services/ocrcommon/data_source_test.go b/core/services/ocrcommon/data_source_test.go index b93314c8afe..8c86f7c7bb2 100644 --- a/core/services/ocrcommon/data_source_test.go +++ b/core/services/ocrcommon/data_source_test.go @@ -33,6 +33,7 @@ var ( ) func Test_InMemoryDataSource(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) runner.On("ExecuteRun", mock.Anything, mock.AnythingOfType("pipeline.Spec"), mock.Anything, mock.Anything). Return(&pipeline.Run{}, pipeline.TaskRunResults{ @@ -52,6 +53,7 @@ func Test_InMemoryDataSource(t *testing.T) { } func Test_CachedInMemoryDataSourceErrHandling(t *testing.T) { + t.Parallel() if testing.Short() { t.Skip("too slow for testing.Short") } @@ -78,6 +80,7 @@ func Test_CachedInMemoryDataSourceErrHandling(t *testing.T) { } } t.Run("test normal cache updater fail recovery", func(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) ds := ocrcommon.NewInMemoryDataSource(runner, job.Job{}, pipeline.Spec{}, logger.TestLogger(t)) mockKVStore := mocks.KVStore{} @@ -113,6 +116,7 @@ func Test_CachedInMemoryDataSourceErrHandling(t *testing.T) { }) t.Run("test total updater fail with persisted value recovery", func(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) ds := ocrcommon.NewInMemoryDataSource(runner, job.Job{}, pipeline.Spec{}, logger.TestLogger(t)) @@ -136,6 +140,7 @@ func Test_CachedInMemoryDataSourceErrHandling(t *testing.T) { }) t.Run("test total updater fail with no persisted value ", func(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) ds := ocrcommon.NewInMemoryDataSource(runner, job.Job{}, pipeline.Spec{}, logger.TestLogger(t)) @@ -154,6 +159,7 @@ func Test_CachedInMemoryDataSourceErrHandling(t *testing.T) { }) } +//nolint:paralleltest // asserts on process-global Prometheus counters func Test_InMemoryDataSourceWithProm(t *testing.T) { runner := pipelinemocks.NewRunner(t) @@ -211,6 +217,7 @@ func (ms *mockSaver) Save(r *pipeline.Run) { } func Test_NewDataSourceV2(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) ms := &mockSaver{} runner.On("ExecuteRun", mock.Anything, mock.AnythingOfType("pipeline.Spec"), mock.Anything, mock.Anything). @@ -232,6 +239,7 @@ func Test_NewDataSourceV2(t *testing.T) { } func Test_NewDataSourceV1(t *testing.T) { + t.Parallel() runner := pipelinemocks.NewRunner(t) ms := &mockSaver{} runner.On("ExecuteRun", mock.Anything, mock.AnythingOfType("pipeline.Spec"), mock.Anything, mock.Anything). diff --git a/core/services/ocrcommon/discoverer_database_test.go b/core/services/ocrcommon/discoverer_database_test.go index a6f175d4522..51b12ecc467 100644 --- a/core/services/ocrcommon/discoverer_database_test.go +++ b/core/services/ocrcommon/discoverer_database_test.go @@ -16,6 +16,7 @@ import ( ) func Test_DiscovererDatabase(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) localPeerID1 := mustRandomP2PPeerID(t) @@ -40,7 +41,7 @@ func Test_DiscovererDatabase(t *testing.T) { }, } - for _, tt := range tests { + for _, tt := range tests { //nolint:paralleltest // subtests build on rows written by earlier subtests dd1 := tt.dd1 dd2 := tt.dd2 diff --git a/core/services/ocrcommon/peer_wrapper_test.go b/core/services/ocrcommon/peer_wrapper_test.go index a19423697a7..2701a704512 100644 --- a/core/services/ocrcommon/peer_wrapper_test.go +++ b/core/services/ocrcommon/peer_wrapper_test.go @@ -24,22 +24,24 @@ import ( func Test_SingletonPeerWrapper_Start(t *testing.T) { t.Parallel() - db := pgtest.NewSqlxDB(t) - var peerID ragep2ptypes.PeerID require.NoError(t, peerID.UnmarshalText([]byte(configtest.DefaultPeerID))) t.Run("with no p2p keys returns error", func(t *testing.T) { + t.Parallel() cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.P2P.V2.Enabled = new(true) }) + db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) pw := ocrcommon.NewSingletonPeerWrapper(keyStore, cfg.P2P(), cfg.OCR(), db, logger.TestLogger(t)) require.Contains(t, pw.Start(t.Context()).Error(), "No P2P keys found in keystore. Peer wrapper will not be fully initialized") }) t.Run("with one p2p key and matching P2P.PeerID returns nil", func(t *testing.T) { + t.Parallel() ctx := t.Context() + db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) k, err := keyStore.P2P().Create(ctx) require.NoError(t, err) @@ -56,11 +58,13 @@ func Test_SingletonPeerWrapper_Start(t *testing.T) { }) t.Run("with one p2p key and mismatching P2P.PeerID returns error", func(t *testing.T) { + t.Parallel() ctx := t.Context() cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.P2P.V2.Enabled = new(true) c.P2P.PeerID = new(p2pkey.PeerID(peerID)) }) + db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) _, err := keyStore.P2P().Create(ctx) @@ -72,7 +76,9 @@ func Test_SingletonPeerWrapper_Start(t *testing.T) { }) t.Run("with multiple p2p keys and valid P2P.PeerID returns nil", func(t *testing.T) { + t.Parallel() ctx := t.Context() + db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) k2, err := keyStore.P2P().Create(ctx) require.NoError(t, err) @@ -90,12 +96,14 @@ func Test_SingletonPeerWrapper_Start(t *testing.T) { }) t.Run("with multiple p2p keys and mismatching P2P.PeerID returns error", func(t *testing.T) { + t.Parallel() ctx := t.Context() cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.P2P.V2.Enabled = new(true) c.P2P.V2.ListenAddresses = &[]string{fmt.Sprintf("127.0.0.1:%d", freeport.GetOne(t))} c.P2P.PeerID = new(p2pkey.PeerID(peerID)) }) + db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db) _, err := keyStore.P2P().Create(ctx) diff --git a/core/services/ocrcommon/run_saver_test.go b/core/services/ocrcommon/run_saver_test.go index bc051a9a424..a1c2ec5619c 100644 --- a/core/services/ocrcommon/run_saver_test.go +++ b/core/services/ocrcommon/run_saver_test.go @@ -12,6 +12,7 @@ import ( ) func TestRunSaver(t *testing.T) { + t.Parallel() pipelineRunner := mocks.NewRunner(t) rs := NewResultRunSaver( pipelineRunner, diff --git a/core/services/ocrcommon/telemetry_test.go b/core/services/ocrcommon/telemetry_test.go index ea431b60e2f..411cc95b5e1 100644 --- a/core/services/ocrcommon/telemetry_test.go +++ b/core/services/ocrcommon/telemetry_test.go @@ -100,6 +100,7 @@ var trrs = pipeline.TaskRunResults{ } func TestShouldCollectTelemetry(t *testing.T) { + t.Parallel() j := job.Job{ OCROracleSpec: &job.OCROracleSpec{CaptureEATelemetry: true}, OCR2OracleSpec: &job.OCR2OracleSpec{CaptureEATelemetry: true}, @@ -120,6 +121,7 @@ func TestShouldCollectTelemetry(t *testing.T) { } func TestGetContract(t *testing.T) { + t.Parallel() j := job.Job{ OCROracleSpec: &job.OCROracleSpec{CaptureEATelemetry: true}, OCR2OracleSpec: &job.OCR2OracleSpec{CaptureEATelemetry: true}, @@ -143,6 +145,7 @@ func TestGetContract(t *testing.T) { } func TestGetChainID(t *testing.T) { + t.Parallel() j := job.Job{ OCROracleSpec: &job.OCROracleSpec{CaptureEATelemetry: true}, OCR2OracleSpec: &job.OCR2OracleSpec{CaptureEATelemetry: true}, @@ -166,6 +169,7 @@ func TestGetChainID(t *testing.T) { } func TestParseEATelemetry(t *testing.T) { + t.Parallel() ea, err := parseEATelemetry([]byte(bridgeResponse)) require.NoError(t, err) assert.Equal(t, "data-source-name", ea.DataSource) @@ -179,6 +183,7 @@ func TestParseEATelemetry(t *testing.T) { } func TestGetJsonParsedValue(t *testing.T) { + t.Parallel() resp := getJSONParsedValue(trrs[0], &trrs) assert.InEpsilon(t, 123456.123456789, *resp, 1e-9) @@ -191,6 +196,7 @@ func TestGetJsonParsedValue(t *testing.T) { } func TestGetJsonParsedValueHexValues(t *testing.T) { + t.Parallel() trrsHexData := pipeline.TaskRunResults{ pipeline.TaskRunResult{ Task: &pipeline.BridgeTask{ @@ -285,6 +291,7 @@ func TestGetJsonParsedValueHexValues(t *testing.T) { } func TestSendEATelemetry(t *testing.T) { + t.Parallel() wg := sync.WaitGroup{} ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) @@ -373,6 +380,7 @@ func TestSendEATelemetry(t *testing.T) { } func TestGetObservation(t *testing.T) { + t.Parallel() j := job.Job{ OCROracleSpec: &job.OCROracleSpec{CaptureEATelemetry: true}, OCR2OracleSpec: &job.OCR2OracleSpec{CaptureEATelemetry: true}, @@ -398,6 +406,7 @@ func TestGetObservation(t *testing.T) { } func TestCollectAndSend(t *testing.T) { + t.Parallel() wg := sync.WaitGroup{} ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) @@ -578,6 +587,7 @@ var trrsMercuryV4 = pipeline.TaskRunResults{ } func TestGetPricesFromBridgeByTelemetryField(t *testing.T) { + t.Parallel() lggr, _ := logger.TestLoggerObserved(t, zap.WarnLevel) // These are intentionally out of order from the "legacy" method which expects order of `benchmark, bid, ask` jsonParseTaskBid := pipeline.JSONParseTask{ @@ -647,6 +657,7 @@ func TestGetPricesFromBridgeByTelemetryField(t *testing.T) { } func TestGetPricesFromBridgeTaskByOrder(t *testing.T) { + t.Parallel() lggr, logs := logger.TestLoggerObserved(t, zap.WarnLevel) benchmarkPrice, bid, ask := getPricesFromBridgeTask(lggr, trrsMercuryV1[0], trrsMercuryV1, 1) @@ -716,6 +727,7 @@ func TestGetPricesFromBridgeTaskByOrder(t *testing.T) { } func TestShouldCollectEnhancedTelemetryMercury(t *testing.T) { + t.Parallel() j := job.Job{ Type: job.Type(pipeline.OffchainReporting2JobType), OCR2OracleSpec: &job.OCR2OracleSpec{ @@ -732,6 +744,7 @@ func TestShouldCollectEnhancedTelemetryMercury(t *testing.T) { } func TestParseBridgeRequestData(t *testing.T) { + t.Parallel() require.Equal(t, bridgeRequestData{}, parseBridgeRequestData("", 2)) reqData := `{"data":{"to":"LINK","from":"USD"}}` @@ -821,6 +834,7 @@ func getViewFunctionTaskRunResults() pipeline.TaskRunResults { } func TestCollectMercuryEnhancedTelemetryV1ViewFunction(t *testing.T) { + t.Parallel() wg := sync.WaitGroup{} ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) @@ -908,6 +922,7 @@ func TestCollectMercuryEnhancedTelemetryV1ViewFunction(t *testing.T) { } func TestCollectMercuryEnhancedTelemetryV1(t *testing.T) { + t.Parallel() wg := sync.WaitGroup{} ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) @@ -1027,6 +1042,7 @@ func TestCollectMercuryEnhancedTelemetryV1(t *testing.T) { } func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) { + t.Parallel() wg := sync.WaitGroup{} ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) @@ -1145,6 +1161,7 @@ func TestCollectMercuryEnhancedTelemetryV2(t *testing.T) { } func TestCollectMercuryEnhancedTelemetryV4(t *testing.T) { + t.Parallel() ingressClient := mocks.NewTelemetryService(t) ingressAgent := telemetry.NewIngressAgentWrapper(ingressClient) monitoringEndpoint := ingressAgent.GenMonitoringEndpoint("test-network", "test-chainID", "0xa", synchronization.EnhancedEAMercury) From 3ba210253f85b4597397a9577eefe97171027f0b Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Wed, 11 Nov 2026 16:59:27 -0500 Subject: [PATCH 3/3] test: add t.Parallel to wave 3 pipeline tests 210 sites across 44 files. Pipeline was the slowest unit-test package in the baseline diagnose run (p50 29.9s); it is now 3.6s. Kept sequential: - TestBridgeTask_Headers and TestBridgeTask_AdapterTimeout subtests share one bridge task, DB handle and captured headers. - TestModeTask/'with json vars' shares table values that JSONWithVarExprs writes back to, so it must not overlap its parallel siblings. - Test_LookupTask now builds its own task and inputs per subtest instead of mutating parent-scoped ones. --- core/services/pipeline/common_eth_test.go | 3 ++ core/services/pipeline/common_test.go | 17 +++++++++++ core/services/pipeline/getters_test.go | 11 ++++++++ core/services/pipeline/graph_test.go | 2 ++ core/services/pipeline/keypath_test.go | 3 ++ core/services/pipeline/models_test.go | 3 ++ core/services/pipeline/orm_test.go | 9 ++++++ core/services/pipeline/runner_test.go | 19 +++++++++++++ core/services/pipeline/scheduler_test.go | 1 + core/services/pipeline/task.any_test.go | 1 + .../pipeline/task.base64decode_test.go | 4 +++ .../pipeline/task.base64encode_test.go | 4 +++ core/services/pipeline/task.bridge_test.go | 13 +++++---- core/services/pipeline/task.cborparse_test.go | 2 ++ core/services/pipeline/task.coalesce_test.go | 1 + .../pipeline/task.conditional_test.go | 3 ++ core/services/pipeline/task.divide_test.go | 5 ++++ .../pipeline/task.eth_abi_decode_log_test.go | 2 ++ .../pipeline/task.eth_abi_decode_test.go | 2 ++ .../pipeline/task.eth_abi_encode_2_test.go | 2 ++ .../pipeline/task.eth_abi_encode_test.go | 6 ++++ core/services/pipeline/task.eth_call_test.go | 1 + core/services/pipeline/task.eth_tx_test.go | 1 + core/services/pipeline/task.hexdecode_test.go | 4 +++ core/services/pipeline/task.hexencode_test.go | 4 +++ core/services/pipeline/task.http_test.go | 4 +++ core/services/pipeline/task.jsonparse_test.go | 1 + core/services/pipeline/task.length_test.go | 4 +++ core/services/pipeline/task.lessthan_test.go | 5 ++++ core/services/pipeline/task.lookup_test.go | 28 +++++++++++-------- core/services/pipeline/task.lowercase_test.go | 4 +++ core/services/pipeline/task.max_test.go | 4 +++ core/services/pipeline/task.mean_test.go | 4 +++ core/services/pipeline/task.median_test.go | 5 ++++ core/services/pipeline/task.memo_test.go | 1 + core/services/pipeline/task.merge_test.go | 1 + core/services/pipeline/task.min_test.go | 4 +++ core/services/pipeline/task.mode_test.go | 6 ++++ core/services/pipeline/task.multiply_test.go | 5 ++++ core/services/pipeline/task.sum_test.go | 4 +++ core/services/pipeline/task.uppercase_test.go | 4 +++ .../pipeline/task_object_params_test.go | 3 ++ core/services/pipeline/task_params_test.go | 21 ++++++++++++++ core/services/pipeline/variables_test.go | 8 ++++++ 44 files changed, 222 insertions(+), 17 deletions(-) diff --git a/core/services/pipeline/common_eth_test.go b/core/services/pipeline/common_eth_test.go index d8ca3fff46c..67bf04dcefc 100644 --- a/core/services/pipeline/common_eth_test.go +++ b/core/services/pipeline/common_eth_test.go @@ -94,6 +94,7 @@ func Test_convertToETHABIType(t *testing.T) { for _, tc := range tt.cases { abiType := mustABIType(t, tc.abiType) t.Run(fmt.Sprintf("%s:%T", tc.abiType, tc.exp), func(t *testing.T) { + t.Parallel() for _, val := range tt.vals { t.Run(fmt.Sprintf("%T", val), func(t *testing.T) { got, err := convertToETHABIType(val, abiType) @@ -118,6 +119,7 @@ func Test_convertToETHABIType_Errors(t *testing.T) { {"0xasdfasdfasdfasdfasdfsadfasdfasdfasdfasdf", "invalid hex"}, } { t.Run(fmt.Sprintf("%T,%s", tt.val, tt.errStr), func(t *testing.T) { + t.Parallel() _, err := convertToETHABIType(tt.val, mustABIType(t, "bytes20")) require.Error(t, err) assert.Contains(t, err.Error(), tt.errStr) @@ -139,6 +141,7 @@ func Test_convertToETHABIBytes_Errors(t *testing.T) { {"0xasdfasdfasdfasdfasdfsadfasdfasdfasdfasdf", "invalid hex"}, } { t.Run(fmt.Sprintf("%T,%s", tt.val, tt.errStr), func(t *testing.T) { + t.Parallel() a := reflect.TypeFor[[20]byte]() b := reflect.ValueOf(tt.val) _, err := convertToETHABIBytes(a, b, 20) diff --git a/core/services/pipeline/common_test.go b/core/services/pipeline/common_test.go index 114a77abb4d..a59cb6307b9 100644 --- a/core/services/pipeline/common_test.go +++ b/core/services/pipeline/common_test.go @@ -104,6 +104,7 @@ func TestRetryUnmarshal(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() p, err := pipeline.Parse(test.spec) require.NoError(t, err) require.Len(t, p.Tasks, 1) @@ -118,6 +119,7 @@ func TestUnmarshalTaskFromMap(t *testing.T) { t.Parallel() t.Run("returns error if task is not the right type", func(t *testing.T) { + t.Parallel() taskMap := any(nil) _, err := pipeline.UnmarshalTaskFromMap(pipeline.TaskType("http"), taskMap, 0, "foo-dot-id") require.EqualError(t, err, "UnmarshalTaskFromMap: UnmarshalTaskFromMap only accepts a map[string]interface{} or a map[string]string. Got () of type ") @@ -132,6 +134,7 @@ func TestUnmarshalTaskFromMap(t *testing.T) { }) t.Run("unknown task type", func(t *testing.T) { + t.Parallel() taskMap := map[string]string{} _, err := pipeline.UnmarshalTaskFromMap(pipeline.TaskType("xxx"), taskMap, 0, "foo-dot-id") require.EqualError(t, err, `UnmarshalTaskFromMap: unknown task type: "xxx"`) @@ -187,6 +190,7 @@ func TestUnmarshalTaskFromMap(t *testing.T) { for _, test := range tests { t.Run(string(test.taskType), func(t *testing.T) { + t.Parallel() taskMap := map[string]string{} task, err := pipeline.UnmarshalTaskFromMap(test.taskType, taskMap, 0, "foo-dot-id") require.NoError(t, err) @@ -225,6 +229,7 @@ func TestCheckInputs(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() outputs, err := pipeline.CheckInputs(test.pr, test.minLen, test.maxLen, test.maxErrors) if test.err == nil { require.NoError(t, err) @@ -265,43 +270,51 @@ func TestSelectGasLimit(t *testing.T) { cfg := evmtest.NewChainScopedConfig(t, gcfg) t.Run("spec defined gas limit", func(t *testing.T) { + t.Parallel() var specGasLimit uint32 = 1 gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.DirectRequestJobType, &specGasLimit) assert.Equal(t, uint64(1), gasLimit) }) t.Run("direct request specific gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.DirectRequestJobType, nil) assert.Equal(t, uint64(100), gasLimit) }) t.Run("OCR specific gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.OffchainReportingJobType, nil) assert.Equal(t, uint64(103), gasLimit) }) t.Run("OCR2 specific gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.OffchainReporting2JobType, nil) assert.Equal(t, uint64(105), gasLimit) }) t.Run("VRF specific gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.VRFJobType, nil) assert.Equal(t, uint64(101), gasLimit) }) t.Run("flux monitor specific gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.FluxMonitorJobType, nil) assert.Equal(t, uint64(102), gasLimit) }) t.Run("fallback to default gas limit", func(t *testing.T) { + t.Parallel() gasLimit := pipeline.SelectGasLimit(cfg.EVM().GasEstimator(), pipeline.WebhookJobType, nil) assert.Equal(t, uint64(999), gasLimit) }) } func TestGetNextTaskOf(t *testing.T) { + t.Parallel() trrs := pipeline.TaskRunResults{ { Task: &pipeline.BridgeTask{ @@ -343,6 +356,7 @@ func TestGetDescendantTasks(t *testing.T) { t.Parallel() t.Run("GetDescendantTasks with multiple levels of tasks", func(t *testing.T) { + t.Parallel() l3T2 := pipeline.AnyTask{ BaseTask: pipeline.NewBaseTask(6, "l3T2", nil, nil, 1), } @@ -372,6 +386,7 @@ func TestGetDescendantTasks(t *testing.T) { }) t.Run("GetDescendantTasks with duplicate tasks defined", func(t *testing.T) { + t.Parallel() l2T1 := pipeline.JSONParseTask{ BaseTask: pipeline.NewBaseTask(2, "l1T2", nil, nil, 3), } @@ -387,6 +402,7 @@ func TestGetDescendantTasks(t *testing.T) { }) t.Run("GetDescendantTasks with nil output tasks", func(t *testing.T) { + t.Parallel() taskWithRepeats := pipeline.BridgeTask{ Name: "bridge-task", BaseTask: pipeline.NewBaseTask(0, "taskWithRepeats", nil, nil, 0), @@ -396,6 +412,7 @@ func TestGetDescendantTasks(t *testing.T) { }) t.Run("GetDescendantTasks with empty list of output tasks", func(t *testing.T) { + t.Parallel() taskWithRepeats := pipeline.BridgeTask{ Name: "bridge-task", BaseTask: pipeline.NewBaseTask(0, "taskWithRepeats", nil, []pipeline.Task{}, 0), diff --git a/core/services/pipeline/getters_test.go b/core/services/pipeline/getters_test.go index 20b2b17ecdb..046bc1a5a75 100644 --- a/core/services/pipeline/getters_test.go +++ b/core/services/pipeline/getters_test.go @@ -45,6 +45,7 @@ func TestGetters_VarExpr(t *testing.T) { for _, test := range tests { t.Run(test.expr, func(t *testing.T) { + t.Parallel() getter := pipeline.VarExpr(test.expr, vars) v, err := getter() if test.err == nil { @@ -99,6 +100,7 @@ func TestGetters_JSONWithVarExprs(t *testing.T) { for _, test := range tests { t.Run(test.json, func(t *testing.T) { + t.Parallel() getter := pipeline.JSONWithVarExprs(test.json, vars, test.allowErrors) v, err := getter() if test.err != nil { @@ -119,6 +121,7 @@ func TestGetters_Input(t *testing.T) { t.Parallel() t.Run("returns the requested input's Value and Error if they exist", func(t *testing.T) { + t.Parallel() expectedVal := "bar" expectedErr := errors.New("some err") val, err := pipeline.Input([]pipeline.Result{{Value: "foo"}, {Value: expectedVal, Error: expectedErr}, {Value: "baz"}}, 1)() @@ -127,6 +130,7 @@ func TestGetters_Input(t *testing.T) { }) t.Run("returns ErrIndexOutOfRange if the specified index is out of range", func(t *testing.T) { + t.Parallel() _, err := pipeline.Input([]pipeline.Result{{Value: "foo"}}, 1)() assert.Equal(t, pipeline.ErrIndexOutOfRange, errors.Cause(err)) _, err = pipeline.Input([]pipeline.Result{{Value: "foo"}}, -1)() @@ -165,6 +169,7 @@ func TestGetters_Inputs(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() val, err := pipeline.Inputs(test.inputs)() assert.Equal(t, test.expectedErr, errors.Cause(err)) assert.Equal(t, test.expected, val) @@ -176,12 +181,14 @@ func TestGetters_NonemptyString(t *testing.T) { t.Parallel() t.Run("returns any non-empty string", func(t *testing.T) { + t.Parallel() val, err := pipeline.NonemptyString("foo bar")() require.NoError(t, err) assert.Equal(t, "foo bar", val) }) t.Run("returns ErrParameterEmpty when given an empty string (including only spaces)", func(t *testing.T) { + t.Parallel() _, err := pipeline.NonemptyString("")() assert.Equal(t, pipeline.ErrParameterEmpty, errors.Cause(err)) _, err = pipeline.NonemptyString(" ")() @@ -193,6 +200,7 @@ func TestGetters_ValidDurationInSeconds(t *testing.T) { t.Parallel() t.Run("returns duration in seconds", func(t *testing.T) { + t.Parallel() val, err := pipeline.ValidDurationInSeconds("10s")() require.NoError(t, err) assert.Equal(t, 10, val) @@ -207,6 +215,7 @@ func TestGetters_ValidDurationInSeconds(t *testing.T) { }) t.Run("returns ErrParameterEmpty when given an empty string (including only spaces)", func(t *testing.T) { + t.Parallel() _, err := pipeline.ValidDurationInSeconds("")() assert.Equal(t, pipeline.ErrParameterEmpty, errors.Cause(err)) _, err = pipeline.ValidDurationInSeconds(" ")() @@ -214,6 +223,7 @@ func TestGetters_ValidDurationInSeconds(t *testing.T) { }) t.Run("returns duration errors when given invalid durations", func(t *testing.T) { + t.Parallel() _, err := pipeline.ValidDurationInSeconds("1b")() assert.Contains(t, err.Error(), "unknown unit") _, err = pipeline.ValidDurationInSeconds("5")() @@ -262,6 +272,7 @@ func TestGetters_From(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() getters := pipeline.From(test.input...) assert.Len(t, getters, 2) diff --git a/core/services/pipeline/graph_test.go b/core/services/pipeline/graph_test.go index 80469c730da..28479f43321 100644 --- a/core/services/pipeline/graph_test.go +++ b/core/services/pipeline/graph_test.go @@ -257,6 +257,7 @@ func TestGraph_ImplicitDependencies(t *testing.T) { } func TestParse(t *testing.T) { + t.Parallel() for _, s := range []struct { name string pipeline string @@ -266,6 +267,7 @@ func TestParse(t *testing.T) { {"foo", "foo"}, } { t.Run(s.name, func(t *testing.T) { + t.Parallel() _, err := pipeline.Parse(s.pipeline) assert.Error(t, err) }) diff --git a/core/services/pipeline/keypath_test.go b/core/services/pipeline/keypath_test.go index 6a059b1695d..d04d450d2dd 100644 --- a/core/services/pipeline/keypath_test.go +++ b/core/services/pipeline/keypath_test.go @@ -13,6 +13,7 @@ func TestKeypath(t *testing.T) { t.Parallel() t.Run("can be constructed from a period-delimited string", func(t *testing.T) { + t.Parallel() kp, err := pipeline.NewKeypathFromString("") require.NoError(t, err) assert.Equal(t, pipeline.Keypath{}, kp) @@ -31,6 +32,7 @@ func TestKeypath(t *testing.T) { }) t.Run("wrong keypath", func(t *testing.T) { + t.Parallel() wrongKeyPath := []string{ ".", "..", @@ -42,6 +44,7 @@ func TestKeypath(t *testing.T) { for _, keypath := range wrongKeyPath { t.Run(keypath, func(t *testing.T) { + t.Parallel() _, err := pipeline.NewKeypathFromString(keypath) assert.ErrorIs(t, err, pipeline.ErrWrongKeypath) }) diff --git a/core/services/pipeline/models_test.go b/core/services/pipeline/models_test.go index cfb353a3a11..5d276acc1ee 100644 --- a/core/services/pipeline/models_test.go +++ b/core/services/pipeline/models_test.go @@ -68,12 +68,14 @@ func TestRun_Status(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() assert.Equal(t, tc.want, tc.run.Status()) }) } } func TestRunErrors_ToError(t *testing.T) { + t.Parallel() runErrors := make(pipeline.RunErrors, 0, 3) runErrors = append(runErrors, null.NewString("bad thing happened", true)) runErrors = append(runErrors, null.NewString("pretty bad thing happened", true)) @@ -115,6 +117,7 @@ func TestRun_StringOutputs(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { + t.Parallel() run := &pipeline.Run{ Outputs: jsonserializable.JSONSerializable{ Valid: true, diff --git a/core/services/pipeline/orm_test.go b/core/services/pipeline/orm_test.go index ed3aeb61c12..e8248afbe90 100644 --- a/core/services/pipeline/orm_test.go +++ b/core/services/pipeline/orm_test.go @@ -82,6 +82,7 @@ func setupLiteORM(t *testing.T) (db *sqlx.DB, orm pipeline.ORM, jorm job.ORM) { } func Test_PipelineORM_CreateSpec(t *testing.T) { + t.Parallel() ctx := t.Context() db, orm, _ := setupLiteORM(t) @@ -105,6 +106,7 @@ func Test_PipelineORM_CreateSpec(t *testing.T) { } func Test_PipelineORM_FindRun(t *testing.T) { + t.Parallel() db, orm, _ := setupLiteORM(t) _, err := db.Exec(`SET CONSTRAINTS fk_pipeline_runs_pruning_key DEFERRED`) @@ -159,6 +161,7 @@ func mustInsertAsyncRun(t *testing.T, orm pipeline.ORM, jobORM job.ORM) *pipelin } func TestInsertFinishedRuns(t *testing.T) { + t.Parallel() ctx := t.Context() db, orm, _ := setupLiteORM(t) @@ -219,6 +222,7 @@ func TestInsertFinishedRuns(t *testing.T) { } func Test_PipelineORM_InsertFinishedRunWithSpec(t *testing.T) { + t.Parallel() ctx := t.Context() db, orm, jorm := setupLiteORM(t) @@ -296,6 +300,7 @@ answer2 [type=bridge name=election_winner index=1]; // Tests that inserting run results, then later updating the run results via upsert will work correctly. func Test_PipelineORM_StoreRun_ShouldUpsert(t *testing.T) { + t.Parallel() ctx := t.Context() _, orm, jorm := setupLiteORM(t) @@ -376,6 +381,7 @@ func Test_PipelineORM_StoreRun_ShouldUpsert(t *testing.T) { // Tests that trying to persist a partial run while new data became available (i.e. via /v2/restart) // will detect a restart and update the result data on the Run. func Test_PipelineORM_StoreRun_DetectsRestarts(t *testing.T) { + t.Parallel() ctx := t.Context() db, orm, jorm := setupLiteORM(t) @@ -442,6 +448,7 @@ func Test_PipelineORM_StoreRun_DetectsRestarts(t *testing.T) { } func Test_PipelineORM_StoreRun_UpdateTaskRunResult(t *testing.T) { + t.Parallel() ctx := t.Context() _, orm, jorm := setupLiteORM(t) @@ -524,6 +531,7 @@ func Test_PipelineORM_StoreRun_UpdateTaskRunResult(t *testing.T) { } func Test_PipelineORM_DeleteRun(t *testing.T) { + t.Parallel() ctx := t.Context() _, orm, jorm := setupLiteORM(t) @@ -567,6 +575,7 @@ func Test_PipelineORM_DeleteRun(t *testing.T) { } func Test_PipelineORM_DeleteRunsOlderThan(t *testing.T) { + t.Parallel() ctx := t.Context() db, orm, jorm := setupHeavyORM(t) diff --git a/core/services/pipeline/runner_test.go b/core/services/pipeline/runner_test.go index 6c4c1e25b01..616c3f7e8b2 100644 --- a/core/services/pipeline/runner_test.go +++ b/core/services/pipeline/runner_test.go @@ -53,6 +53,7 @@ func newRunner(t testing.TB, db *sqlx.DB, bridgeORM bridges.ORM, cfg chainlink.G } func Test_PipelineRunner_ExecuteTaskRuns(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) @@ -134,6 +135,7 @@ ds5 [type=http method="GET" url="%s" index=2] } func Test_PipelineRunner_ExecuteEthAbiDecode(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) @@ -390,12 +392,14 @@ decode_log -> decode_cbor; ) func Test_PipelineRunner_CBORParse(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) r, _ := newRunner(t, db, btORM, cfg) t.Run("diet mode, empty CBOR", func(t *testing.T) { + t.Parallel() s := CBORDietEmpty d, err := pipeline.Parse(s) require.NoError(t, err) @@ -423,6 +427,7 @@ func Test_PipelineRunner_CBORParse(t *testing.T) { }) t.Run("standard mode, string value", func(t *testing.T) { + t.Parallel() s := CBORStdString d, err := pipeline.Parse(s) require.NoError(t, err) @@ -451,6 +456,7 @@ func Test_PipelineRunner_CBORParse(t *testing.T) { } func Test_PipelineRunner_HandleFaults(t *testing.T) { + t.Parallel() // We want to test the scenario where one or multiple APIs time out, // but a sufficient number of them still complete within the desired time frame // and so we can still obtain a median. @@ -502,6 +508,7 @@ answer1 [type=median index=0]; } func Test_PipelineRunner_HandleFaultsPersistRun(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) orm := mocks.NewORM(t) btORM := bridgesMocks.NewORM(t) @@ -549,6 +556,7 @@ succeed2 -> final; } func Test_PipelineRunner_ExecuteAndInsertFinishedRun_SavingTheSpec(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) orm := mocks.NewORM(t) btORM := bridgesMocks.NewORM(t) @@ -595,6 +603,7 @@ succeed2 -> final; } func Test_PipelineRunner_MultipleOutputs(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -623,6 +632,7 @@ a->b2->c;`, } func Test_PipelineRunner_MultipleTerminatingOutputs(t *testing.T) { + t.Parallel() cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) r, _ := newRunner(t, pgtest.NewSqlxDB(t), btORM, cfg) @@ -645,6 +655,7 @@ a->b2;`, } func Test_PipelineRunner_AsyncJob_Basic(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) btcUSDPairing := utils.MustUnmarshalToMap(`{"data":{"coin":"BTC","market":"USD"}}`) @@ -781,6 +792,7 @@ ds5 [type=http method="GET" url="%s" index=2] } func Test_PipelineRunner_AsyncJob_InstantRestart(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) btcUSDPairing := utils.MustUnmarshalToMap(`{"data":{"coin":"BTC","market":"USD"}}`) @@ -906,6 +918,7 @@ ds5 [type=http method="GET" url="%s" index=2] } func Test_PipelineRunner_LowercaseOutputs(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -929,6 +942,7 @@ a [type=lowercase input="$(first)"] } func Test_PipelineRunner_UppercaseOutputs(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -951,6 +965,7 @@ a [type=uppercase input="$(first)"] } func Test_PipelineRunner_HexDecodeOutputs(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -973,6 +988,7 @@ a [type=hexdecode input="$(astring)"] } func Test_PipelineRunner_HexEncodeAndDecode(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -998,6 +1014,7 @@ en->de } func Test_PipelineRunner_Base64DecodeOutputs(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -1020,6 +1037,7 @@ a [type=base64decode input="$(astring)"] } func Test_PipelineRunner_Base64EncodeAndDecode(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) btORM := bridgesMocks.NewORM(t) @@ -1045,6 +1063,7 @@ en->de } func Test_PipelineRunner_ExecuteRun(t *testing.T) { + t.Parallel() t.Run("uses cached *Pipeline if available", func(t *testing.T) { db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) diff --git a/core/services/pipeline/scheduler_test.go b/core/services/pipeline/scheduler_test.go index 30d13254b3b..bf88c9d3b4c 100644 --- a/core/services/pipeline/scheduler_test.go +++ b/core/services/pipeline/scheduler_test.go @@ -18,6 +18,7 @@ type event struct { } func TestScheduler(t *testing.T) { + t.Parallel() // NOTE: task type does not matter in the test cases, it's just there so it's parsed successfully tests := []struct { name string diff --git a/core/services/pipeline/task.any_test.go b/core/services/pipeline/task.any_test.go index 4f7dfc9aa50..ce8b32f463a 100644 --- a/core/services/pipeline/task.any_test.go +++ b/core/services/pipeline/task.any_test.go @@ -59,6 +59,7 @@ func TestAnyTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.AnyTask{} output, runInfo := task.Run(t.Context(), logger.TestLogger(t), pipeline.NewVarsFrom(nil), test.inputs) assert.False(t, runInfo.IsPending) diff --git a/core/services/pipeline/task.base64decode_test.go b/core/services/pipeline/task.base64decode_test.go index 0d976a4f76b..8ba7989d485 100644 --- a/core/services/pipeline/task.base64decode_test.go +++ b/core/services/pipeline/task.base64decode_test.go @@ -40,12 +40,15 @@ func TestBase64DecodeTask(t *testing.T) { } } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.Base64DecodeTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() inputStr := test.input if inputStr == "" { // empty input parameter is indistinguishable from not providing it at all @@ -60,6 +63,7 @@ func TestBase64DecodeTask(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task.base64encode_test.go b/core/services/pipeline/task.base64encode_test.go index d3bad798519..4957aa91b20 100644 --- a/core/services/pipeline/task.base64encode_test.go +++ b/core/services/pipeline/task.base64encode_test.go @@ -46,12 +46,15 @@ func TestBase64EncodeTask(t *testing.T) { } } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.Base64EncodeTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) @@ -81,6 +84,7 @@ func TestBase64EncodeTaskInputParamLiteral(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.Base64EncodeTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), diff --git a/core/services/pipeline/task.bridge_test.go b/core/services/pipeline/task.bridge_test.go index b5ed4d9f319..ff78f450f59 100644 --- a/core/services/pipeline/task.bridge_test.go +++ b/core/services/pipeline/task.bridge_test.go @@ -1023,6 +1023,7 @@ func TestBridgeTask_IncludeInputAtKey(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) @@ -1192,6 +1193,7 @@ func TestAdapterResponse_UnmarshalJSON_Happy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var response adapterResponse err := json.Unmarshal([]byte(test.content), &response) require.NoError(t, err) @@ -1202,6 +1204,7 @@ func TestAdapterResponse_UnmarshalJSON_Happy(t *testing.T) { } func TestBridgeTask_Headers(t *testing.T) { + t.Parallel() db := pgtest.NewSqlxDB(t) cfg := configtest.NewTestGeneralConfig(t) @@ -1241,7 +1244,7 @@ func TestBridgeTask_Headers(t *testing.T) { standardHeaders := []string{"Content-Length", "38", "Content-Type", "application/json", "User-Agent", "Go-http-client/1.1"} - t.Run("sends headers", func(t *testing.T) { + t.Run("sends headers", func(t *testing.T) { //nolint:paralleltest // subtests share one bridge task and its captured state task := pipeline.BridgeTask{ BaseTask: pipeline.NewBaseTask(0, "bridge", nil, nil, 0), Name: bridge.Name.String(), @@ -1263,7 +1266,7 @@ func TestBridgeTask_Headers(t *testing.T) { assert.Equal(t, append(standardHeaders, "X-Header-1", "foo", "X-Header-2", "bar"), allHeaders(headers)) }) - t.Run("errors with odd number of headers", func(t *testing.T) { + t.Run("errors with odd number of headers", func(t *testing.T) { //nolint:paralleltest // subtests share one bridge task and its captured state task := pipeline.BridgeTask{ BaseTask: pipeline.NewBaseTask(0, "bridge", nil, nil, 0), Name: bridge.Name.String(), @@ -1284,7 +1287,7 @@ func TestBridgeTask_Headers(t *testing.T) { assert.Nil(t, result.Value) }) - t.Run("allows to override content-type", func(t *testing.T) { + t.Run("allows to override content-type", func(t *testing.T) { //nolint:paralleltest // subtests share one bridge task and its captured state task := pipeline.BridgeTask{ BaseTask: pipeline.NewBaseTask(0, "bridge", nil, nil, 0), Name: bridge.Name.String(), @@ -1463,7 +1466,7 @@ func TestBridgeTask_AdapterTimeout(t *testing.T) { }, ) - t.Run("pre-cancelled", func(t *testing.T) { + t.Run("pre-cancelled", func(t *testing.T) { //nolint:paralleltest // subtests share one bridge task and its captured state ctx, cancel := context.WithCancel(t.Context()) cancel() // pre-cancelled result, runInfo := task.Run(ctx, logger.TestLogger(t), vars, nil) @@ -1474,7 +1477,7 @@ func TestBridgeTask_AdapterTimeout(t *testing.T) { require.False(t, runInfo.IsPending) }) - t.Run("short", func(t *testing.T) { + t.Run("short", func(t *testing.T) { //nolint:paralleltest // subtests share one bridge task and its captured state // The deadline must outlast the bridge lookup, which runs against the DB // and shares the ctx's overtime window. With a 1ms deadline that window is // only 100ms for two DB queries, which a loaded machine can miss. Here the diff --git a/core/services/pipeline/task.cborparse_test.go b/core/services/pipeline/task.cborparse_test.go index a4d5e1f71dc..4723cbee550 100644 --- a/core/services/pipeline/task.cborparse_test.go +++ b/core/services/pipeline/task.cborparse_test.go @@ -13,6 +13,7 @@ import ( ) func TestCBORParseTask(t *testing.T) { + t.Parallel() tests := []struct { name string data string @@ -132,6 +133,7 @@ func TestCBORParseTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.CBORParseTask{ BaseTask: pipeline.NewBaseTask(0, "cbor", nil, nil, 0), Data: test.data, diff --git a/core/services/pipeline/task.coalesce_test.go b/core/services/pipeline/task.coalesce_test.go index ac1d84b10c3..fda5c98d605 100644 --- a/core/services/pipeline/task.coalesce_test.go +++ b/core/services/pipeline/task.coalesce_test.go @@ -89,6 +89,7 @@ func TestCoalesceTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.CoalesceTask{} output, runInfo := task.Run(t.Context(), logger.TestLogger(t), pipeline.NewVarsFrom(nil), test.inputs) assert.False(t, runInfo.IsPending) diff --git a/core/services/pipeline/task.conditional_test.go b/core/services/pipeline/task.conditional_test.go index ec57d3626ae..c47225ddbf0 100644 --- a/core/services/pipeline/task.conditional_test.go +++ b/core/services/pipeline/task.conditional_test.go @@ -28,7 +28,9 @@ func TestConditionalTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.ConditionalTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), @@ -46,6 +48,7 @@ func TestConditionalTask(t *testing.T) { } }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task.divide_test.go b/core/services/pipeline/task.divide_test.go index eb226b95f51..393f9be1ffe 100644 --- a/core/services/pipeline/task.divide_test.go +++ b/core/services/pipeline/task.divide_test.go @@ -94,7 +94,9 @@ func TestDivideTask_Happy(t *testing.T) { require.Equal(t, test.expected.String(), result.Value.(decimal.Decimal).String()) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.DivideTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), @@ -104,6 +106,7 @@ func TestDivideTask_Happy(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.DivideTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), @@ -114,6 +117,7 @@ func TestDivideTask_Happy(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, "chain": map[string]any{"link": test.divisor}, @@ -156,6 +160,7 @@ func TestDivideTask_Unhappy(t *testing.T) { for _, tt := range tests { test := tt t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.DivideTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), Input: test.input, diff --git a/core/services/pipeline/task.eth_abi_decode_log_test.go b/core/services/pipeline/task.eth_abi_decode_log_test.go index 5e3ec3ee3b3..ea09eca10ba 100644 --- a/core/services/pipeline/task.eth_abi_decode_log_test.go +++ b/core/services/pipeline/task.eth_abi_decode_log_test.go @@ -16,6 +16,7 @@ import ( ) func TestETHABIDecodeLogTask(t *testing.T) { + t.Parallel() tests := []struct { name string abi string @@ -229,6 +230,7 @@ func TestETHABIDecodeLogTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHABIDecodeLogTask{ BaseTask: pipeline.NewBaseTask(0, "decodelog", nil, nil, 0), ABI: test.abi, diff --git a/core/services/pipeline/task.eth_abi_decode_test.go b/core/services/pipeline/task.eth_abi_decode_test.go index 180e478727e..a3b2843063b 100644 --- a/core/services/pipeline/task.eth_abi_decode_test.go +++ b/core/services/pipeline/task.eth_abi_decode_test.go @@ -120,8 +120,10 @@ var testsABIDecode = []struct { } func TestETHABIDecodeTask(t *testing.T) { + t.Parallel() for _, test := range testsABIDecode { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := ETHABIDecodeTask{ BaseTask: NewBaseTask(0, "decode", nil, nil, 0), ABI: test.abi, diff --git a/core/services/pipeline/task.eth_abi_encode_2_test.go b/core/services/pipeline/task.eth_abi_encode_2_test.go index 8c0b5aad8d8..e71fbe2ed5b 100644 --- a/core/services/pipeline/task.eth_abi_encode_2_test.go +++ b/core/services/pipeline/task.eth_abi_encode_2_test.go @@ -14,6 +14,7 @@ import ( ) func TestETHABIEncodeTask2(t *testing.T) { + t.Parallel() var bytes32 [32]byte copy(bytes32[:], []byte("chainlink chainlink chainlink")) @@ -348,6 +349,7 @@ func TestETHABIEncodeTask2(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHABIEncodeTask2{ BaseTask: pipeline.NewBaseTask(0, "encode", nil, nil, 0), ABI: test.abi, diff --git a/core/services/pipeline/task.eth_abi_encode_test.go b/core/services/pipeline/task.eth_abi_encode_test.go index 9b8cb75a4a4..df7a16131ef 100644 --- a/core/services/pipeline/task.eth_abi_encode_test.go +++ b/core/services/pipeline/task.eth_abi_encode_test.go @@ -16,6 +16,7 @@ import ( ) func TestETHABIEncodeTask(t *testing.T) { + t.Parallel() var bytes32 [32]byte copy(bytes32[:], []byte("chainlink chainlink chainlink")) @@ -215,6 +216,7 @@ func TestETHABIEncodeTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHABIEncodeTask{ BaseTask: pipeline.NewBaseTask(0, "encode", nil, nil, 0), ABI: test.abi, @@ -240,6 +242,7 @@ func TestETHABIEncodeTask(t *testing.T) { } func TestETHABIEncode_EncodeIntegers(t *testing.T) { + t.Parallel() testCases := []struct { name string abi string @@ -505,6 +508,7 @@ func TestETHABIEncode_EncodeIntegers(t *testing.T) { for _, test := range testCases { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHABIEncodeTask{ BaseTask: pipeline.NewBaseTask(0, "encode", nil, nil, 0), ABI: test.abi, @@ -530,6 +534,7 @@ func TestETHABIEncode_EncodeIntegers(t *testing.T) { } func TestETHABIEncode_EncodeIntegers_Overflow(t *testing.T) { + t.Parallel() testCases := []struct { name string abi string @@ -568,6 +573,7 @@ func TestETHABIEncode_EncodeIntegers_Overflow(t *testing.T) { for _, test := range testCases { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHABIEncodeTask{ BaseTask: pipeline.NewBaseTask(0, "encode", nil, nil, 0), ABI: test.abi, diff --git a/core/services/pipeline/task.eth_call_test.go b/core/services/pipeline/task.eth_call_test.go index 5089efa037f..df3a45b6c1d 100644 --- a/core/services/pipeline/task.eth_call_test.go +++ b/core/services/pipeline/task.eth_call_test.go @@ -286,6 +286,7 @@ func TestETHCallTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.ETHCallTask{ BaseTask: pipeline.NewBaseTask(0, "ethcall", nil, nil, 0), Contract: test.contract, diff --git a/core/services/pipeline/task.eth_tx_test.go b/core/services/pipeline/task.eth_tx_test.go index 8932f113db7..fb56fb24356 100644 --- a/core/services/pipeline/task.eth_tx_test.go +++ b/core/services/pipeline/task.eth_tx_test.go @@ -27,6 +27,7 @@ import ( ) func TestETHTxTask(t *testing.T) { + t.Parallel() jid := int32(321) reqID := common.HexToHash("0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2") reqTxHash := common.HexToHash("0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8") diff --git a/core/services/pipeline/task.hexdecode_test.go b/core/services/pipeline/task.hexdecode_test.go index 099176918e7..627321c265b 100644 --- a/core/services/pipeline/task.hexdecode_test.go +++ b/core/services/pipeline/task.hexdecode_test.go @@ -42,12 +42,15 @@ func TestHexDecodeTask(t *testing.T) { } } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.HexDecodeTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() inputStr := test.input if inputStr == "" { // empty input parameter is indistinguishable from not providing it at all @@ -62,6 +65,7 @@ func TestHexDecodeTask(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task.hexencode_test.go b/core/services/pipeline/task.hexencode_test.go index 4ecac626169..3cf15a2add6 100644 --- a/core/services/pipeline/task.hexencode_test.go +++ b/core/services/pipeline/task.hexencode_test.go @@ -71,12 +71,15 @@ func TestHexEncodeTask(t *testing.T) { } } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.HexEncodeTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) @@ -108,6 +111,7 @@ func TestHexEncodeTaskInputParamLiteral(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.HexEncodeTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), diff --git a/core/services/pipeline/task.http_test.go b/core/services/pipeline/task.http_test.go index c93f93a2c15..6398f3d177b 100644 --- a/core/services/pipeline/task.http_test.go +++ b/core/services/pipeline/task.http_test.go @@ -314,6 +314,7 @@ func TestHTTPTask_OnlyErrorMessage(t *testing.T) { } func TestHTTPTask_Headers(t *testing.T) { + t.Parallel() allHeaders := func(headers http.Header) (s []string) { keys := make([]string, 0, len(headers)) for k := range headers { @@ -331,6 +332,7 @@ func TestHTTPTask_Headers(t *testing.T) { standardHeaders := []string{"Content-Length", "38", "Content-Type", "application/json", "User-Agent", "Go-http-client/1.1"} t.Run("sends headers", func(t *testing.T) { + t.Parallel() config := configtest.NewTestGeneralConfig(t) var headers http.Header handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -362,6 +364,7 @@ func TestHTTPTask_Headers(t *testing.T) { }) t.Run("errors with odd number of headers", func(t *testing.T) { + t.Parallel() task := pipeline.HTTPTask{ Method: "POST", URL: "http://example.com", @@ -377,6 +380,7 @@ func TestHTTPTask_Headers(t *testing.T) { }) t.Run("allows to override content-type", func(t *testing.T) { + t.Parallel() config := configtest.NewTestGeneralConfig(t) var headers http.Header handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/core/services/pipeline/task.jsonparse_test.go b/core/services/pipeline/task.jsonparse_test.go index 91be6b261a6..a777eb9b132 100644 --- a/core/services/pipeline/task.jsonparse_test.go +++ b/core/services/pipeline/task.jsonparse_test.go @@ -403,6 +403,7 @@ func TestJSONParseTask(t *testing.T) { for _, tt := range tests { test := tt t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.JSONParseTask{ BaseTask: pipeline.NewBaseTask(0, "json", nil, nil, 0), Path: test.path, diff --git a/core/services/pipeline/task.length_test.go b/core/services/pipeline/task.length_test.go index b8309c856b8..0c920b4ca4b 100644 --- a/core/services/pipeline/task.length_test.go +++ b/core/services/pipeline/task.length_test.go @@ -34,12 +34,15 @@ func TestLengthTask(t *testing.T) { require.Equal(t, test.want.String(), result.Value.(decimal.Decimal).String()) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.LengthTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() var inputStr string if _, ok := test.input.([]byte); ok { inputStr = string(test.input.([]byte)) @@ -59,6 +62,7 @@ func TestLengthTask(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task.lessthan_test.go b/core/services/pipeline/task.lessthan_test.go index fbeaf084787..9d37888820c 100644 --- a/core/services/pipeline/task.lessthan_test.go +++ b/core/services/pipeline/task.lessthan_test.go @@ -71,12 +71,15 @@ func TestLessThanTask_Happy(t *testing.T) { require.Equal(t, test.want, result.Value.(bool)) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.LessThanTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), Right: test.right} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.left}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.LessThanTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), @@ -86,6 +89,7 @@ func TestLessThanTask_Happy(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.left}, "chain": map[string]any{"link": test.right}, @@ -123,6 +127,7 @@ func TestLessThanTask_Unhappy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.LessThanTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), Left: test.left, diff --git a/core/services/pipeline/task.lookup_test.go b/core/services/pipeline/task.lookup_test.go index b8cbe93f463..a2e4fe4eb01 100644 --- a/core/services/pipeline/task.lookup_test.go +++ b/core/services/pipeline/task.lookup_test.go @@ -12,17 +12,17 @@ import ( ) func Test_LookupTask(t *testing.T) { - task := pipeline.LookupTask{} + t.Parallel() m := map[string]any{ "foo": 42, "bar": "baz", } var vars pipeline.Vars - var inputs []pipeline.Result t.Run("with valid key for map", func(t *testing.T) { - task.Key = "foo" - inputs = []pipeline.Result{{Value: m, Error: nil}} + t.Parallel() + task := pipeline.LookupTask{Key: "foo"} + inputs := []pipeline.Result{{Value: m, Error: nil}} res, _ := task.Run(t.Context(), logger.TestLogger(t), vars, inputs) @@ -30,8 +30,9 @@ func Test_LookupTask(t *testing.T) { assert.NoError(t, res.Error) }) t.Run("returns nil if key is missing", func(t *testing.T) { - task.Key = "qux" - inputs = []pipeline.Result{{Value: m, Error: nil}} + t.Parallel() + task := pipeline.LookupTask{Key: "qux"} + inputs := []pipeline.Result{{Value: m, Error: nil}} res, _ := task.Run(t.Context(), logger.TestLogger(t), vars, inputs) @@ -39,8 +40,9 @@ func Test_LookupTask(t *testing.T) { assert.Nil(t, res.Value) }) t.Run("errors when input is not a map", func(t *testing.T) { - task.Key = "qux" - inputs = []pipeline.Result{{Value: "something", Error: nil}} + t.Parallel() + task := pipeline.LookupTask{Key: "qux"} + inputs := []pipeline.Result{{Value: "something", Error: nil}} res, _ := task.Run(t.Context(), logger.TestLogger(t), vars, inputs) @@ -48,8 +50,9 @@ func Test_LookupTask(t *testing.T) { assert.Nil(t, res.Value) }) t.Run("errors when input is error", func(t *testing.T) { - task.Key = "qux" - inputs = []pipeline.Result{{Value: nil, Error: errors.New("something blew up")}} + t.Parallel() + task := pipeline.LookupTask{Key: "qux"} + inputs := []pipeline.Result{{Value: nil, Error: errors.New("something blew up")}} res, _ := task.Run(t.Context(), logger.TestLogger(t), vars, inputs) @@ -57,8 +60,9 @@ func Test_LookupTask(t *testing.T) { assert.Nil(t, res.Value) }) t.Run("errors with too many inputs", func(t *testing.T) { - task.Key = "qux" - inputs = []pipeline.Result{{Value: m, Error: nil}, {Value: nil, Error: errors.New("something blew up")}} + t.Parallel() + task := pipeline.LookupTask{Key: "qux"} + inputs := []pipeline.Result{{Value: m, Error: nil}, {Value: nil, Error: errors.New("something blew up")}} res, _ := task.Run(t.Context(), logger.TestLogger(t), vars, inputs) diff --git a/core/services/pipeline/task.lowercase_test.go b/core/services/pipeline/task.lowercase_test.go index 1b1781d8e2f..c7ecd8f73ce 100644 --- a/core/services/pipeline/task.lowercase_test.go +++ b/core/services/pipeline/task.lowercase_test.go @@ -35,12 +35,15 @@ func TestLowercaseTask(t *testing.T) { require.Equal(t, test.want, result.Value.(string)) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.LowercaseTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() inputStr := fmt.Sprintf("%v", test.input) if inputStr == "" { // empty input parameter is indistinguishable from not providing it at all @@ -55,6 +58,7 @@ func TestLowercaseTask(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task.max_test.go b/core/services/pipeline/task.max_test.go index 5dd97a590c3..05939d54526 100644 --- a/core/services/pipeline/task.max_test.go +++ b/core/services/pipeline/task.max_test.go @@ -181,7 +181,9 @@ func TestMaxTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.MaxTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -205,6 +207,7 @@ func TestMaxTask(t *testing.T) { }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -240,6 +243,7 @@ func TestMaxTask(t *testing.T) { }) t.Run("with json vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { diff --git a/core/services/pipeline/task.mean_test.go b/core/services/pipeline/task.mean_test.go index 09905b4eb6a..bd9c63df07d 100644 --- a/core/services/pipeline/task.mean_test.go +++ b/core/services/pipeline/task.mean_test.go @@ -117,7 +117,9 @@ func TestMeanTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.MeanTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -135,6 +137,7 @@ func TestMeanTask(t *testing.T) { } }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -164,6 +167,7 @@ func TestMeanTask(t *testing.T) { } }) t.Run("with json vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { diff --git a/core/services/pipeline/task.median_test.go b/core/services/pipeline/task.median_test.go index 433fc47644e..1553bc66614 100644 --- a/core/services/pipeline/task.median_test.go +++ b/core/services/pipeline/task.median_test.go @@ -161,7 +161,9 @@ func TestMedianTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.MedianTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -183,6 +185,7 @@ func TestMedianTask(t *testing.T) { } }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -216,6 +219,7 @@ func TestMedianTask(t *testing.T) { } }) t.Run("with json vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -378,6 +382,7 @@ func TestMedianTask_CountNilsAsFaults(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.MedianTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, diff --git a/core/services/pipeline/task.memo_test.go b/core/services/pipeline/task.memo_test.go index 50e87c2cb7b..bf25720f3f1 100644 --- a/core/services/pipeline/task.memo_test.go +++ b/core/services/pipeline/task.memo_test.go @@ -38,6 +38,7 @@ func TestMemoTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) var value pipeline.ObjectParam err := value.UnmarshalPipelineParam(test.input) diff --git a/core/services/pipeline/task.merge_test.go b/core/services/pipeline/task.merge_test.go index ba6b0b99cc4..9144cd2ba49 100644 --- a/core/services/pipeline/task.merge_test.go +++ b/core/services/pipeline/task.merge_test.go @@ -160,6 +160,7 @@ func TestMergeTask(t *testing.T) { for _, tt := range tests { test := tt t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.MergeTask{ BaseTask: pipeline.NewBaseTask(0, "merge", nil, nil, 0), Left: test.left, diff --git a/core/services/pipeline/task.min_test.go b/core/services/pipeline/task.min_test.go index 58c1508a6a8..5109ed0fbf7 100644 --- a/core/services/pipeline/task.min_test.go +++ b/core/services/pipeline/task.min_test.go @@ -181,7 +181,9 @@ func TestMinTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.MinTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -205,6 +207,7 @@ func TestMinTask(t *testing.T) { }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -240,6 +243,7 @@ func TestMinTask(t *testing.T) { }) t.Run("with json vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { diff --git a/core/services/pipeline/task.mode_test.go b/core/services/pipeline/task.mode_test.go index a233eccb2a0..6f70359f372 100644 --- a/core/services/pipeline/task.mode_test.go +++ b/core/services/pipeline/task.mode_test.go @@ -94,7 +94,9 @@ func TestModeTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.ModeTask{ BaseTask: pipeline.NewBaseTask(0, "mode", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -114,6 +116,7 @@ func TestModeTask(t *testing.T) { } }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -144,6 +147,9 @@ func TestModeTask(t *testing.T) { require.NoError(t, output.Error) } }) + // Subtests share table values that JSONWithVarExprs writes back to, + // so this case must not overlap with its parallel siblings. + //nolint:paralleltest // shares table values with parallel siblings t.Run("with json vars", func(t *testing.T) { var inputs []any for _, input := range test.inputs { diff --git a/core/services/pipeline/task.multiply_test.go b/core/services/pipeline/task.multiply_test.go index 95cb96ec3fb..2af70721bdc 100644 --- a/core/services/pipeline/task.multiply_test.go +++ b/core/services/pipeline/task.multiply_test.go @@ -115,12 +115,15 @@ func TestMultiplyTask_Happy(t *testing.T) { require.Equal(t, test.want.String(), result.Value.(decimal.Decimal).String()) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.MultiplyTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), Times: test.times} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.MultiplyTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), @@ -130,6 +133,7 @@ func TestMultiplyTask_Happy(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, "chain": map[string]any{"link": test.times}, @@ -167,6 +171,7 @@ func TestMultiplyTask_Unhappy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() task := pipeline.MultiplyTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), Input: test.input, diff --git a/core/services/pipeline/task.sum_test.go b/core/services/pipeline/task.sum_test.go index e658bdfd7c5..caecdae597b 100644 --- a/core/services/pipeline/task.sum_test.go +++ b/core/services/pipeline/task.sum_test.go @@ -79,7 +79,9 @@ func TestSumTask(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars", func(t *testing.T) { + t.Parallel() task := pipeline.SumTask{ BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0), AllowedFaults: test.allowedFaults, @@ -96,6 +98,7 @@ func TestSumTask(t *testing.T) { } }) t.Run("with vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { @@ -125,6 +128,7 @@ func TestSumTask(t *testing.T) { } }) t.Run("with json vars", func(t *testing.T) { + t.Parallel() var inputs []any for _, input := range test.inputs { if input.Error != nil { diff --git a/core/services/pipeline/task.uppercase_test.go b/core/services/pipeline/task.uppercase_test.go index 963116e9e91..03f56c8aedb 100644 --- a/core/services/pipeline/task.uppercase_test.go +++ b/core/services/pipeline/task.uppercase_test.go @@ -35,12 +35,15 @@ func TestUppercaseTask(t *testing.T) { require.Equal(t, test.want, result.Value.(string)) } t.Run(test.name, func(t *testing.T) { + t.Parallel() t.Run("without vars through job DAG", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(nil) task := pipeline.UppercaseTask{BaseTask: pipeline.NewBaseTask(0, "task", nil, nil, 0)} assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{{Value: test.input}})) }) t.Run("without vars through input param", func(t *testing.T) { + t.Parallel() inputStr := fmt.Sprintf("%v", test.input) if inputStr == "" { // empty input parameter is indistinguishable from not providing it at all @@ -55,6 +58,7 @@ func TestUppercaseTask(t *testing.T) { assertOK(task.Run(t.Context(), logger.TestLogger(t), vars, []pipeline.Result{})) }) t.Run("with vars", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{"bar": test.input}, }) diff --git a/core/services/pipeline/task_object_params_test.go b/core/services/pipeline/task_object_params_test.go index a05147f90da..9bf807d40fa 100644 --- a/core/services/pipeline/task_object_params_test.go +++ b/core/services/pipeline/task_object_params_test.go @@ -61,6 +61,7 @@ func TestObjectParam_UnmarshalPipelineParamValid(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var value pipeline.ObjectParam err := value.UnmarshalPipelineParam(test.input) require.NoError(t, err) @@ -72,6 +73,7 @@ func TestObjectParam_UnmarshalPipelineParamValid(t *testing.T) { } func TestObjectParam_Marshal(t *testing.T) { + t.Parallel() tests := []struct { name string input *pipeline.ObjectParam @@ -87,6 +89,7 @@ func TestObjectParam_Marshal(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() marshalledValue, err := test.input.Marshal() require.NoError(t, err) assert.Equal(t, test.output, marshalledValue) diff --git a/core/services/pipeline/task_params_test.go b/core/services/pipeline/task_params_test.go index 71ca8d6f2cc..4186660ec0e 100644 --- a/core/services/pipeline/task_params_test.go +++ b/core/services/pipeline/task_params_test.go @@ -41,6 +41,7 @@ func TestStringParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.StringParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -74,6 +75,7 @@ func TestStringSliceParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.StringSliceParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -104,6 +106,7 @@ func TestBytesParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.BytesParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -148,6 +151,7 @@ func TestAddressParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.AddressParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -184,6 +188,7 @@ func TestAddressSliceParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.AddressSliceParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -229,6 +234,7 @@ func TestUint64Param_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.Uint64Param err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -275,6 +281,7 @@ func TestMaybeUint64Param_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.MaybeUint64Param err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -330,6 +337,7 @@ func TestMaybeBigIntParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.MaybeBigIntParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -372,6 +380,7 @@ func TestMaybeInt32Param_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.MaybeInt32Param err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -400,6 +409,7 @@ func TestBoolParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.BoolParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -434,6 +444,7 @@ func TestDecimalParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.DecimalParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -461,6 +472,7 @@ func TestURLParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.URLParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -523,6 +535,7 @@ func TestMapParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.MapParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -549,6 +562,7 @@ func TestSliceParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.SliceParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -582,6 +596,7 @@ func TestHashSliceParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.HashSliceParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -633,6 +648,7 @@ func TestDecimalSliceParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.DecimalSliceParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -661,6 +677,7 @@ func TestJSONPathParam_UnmarshalPipelineParam(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() var p pipeline.JSONPathParam err := p.UnmarshalPipelineParam(test.input) require.Equal(t, test.err, errors.Cause(err)) @@ -673,6 +690,7 @@ func TestResolveValue(t *testing.T) { t.Parallel() t.Run("calls getters in order until the first one that returns without ErrParameterEmpty", func(t *testing.T) { + t.Parallel() param := mocks.NewPipelineParamUnmarshaler(t) param.On("UnmarshalPipelineParam", mock.Anything).Return(nil) @@ -698,6 +716,7 @@ func TestResolveValue(t *testing.T) { }) t.Run("returns any GetterFunc error that isn't ErrParameterEmpty", func(t *testing.T) { + t.Parallel() param := mocks.NewPipelineParamUnmarshaler(t) called := []int{} expectedErr := errors.New("some other issue") @@ -723,6 +742,7 @@ func TestResolveValue(t *testing.T) { }) t.Run("calls UnmarshalPipelineParam with the value obtained from the GetterFuncs", func(t *testing.T) { + t.Parallel() expectedValue := 123 param := mocks.NewPipelineParamUnmarshaler(t) @@ -739,6 +759,7 @@ func TestResolveValue(t *testing.T) { }) t.Run("returns any error returned by UnmarshalPipelineParam", func(t *testing.T) { + t.Parallel() expectedValue := 123 expectedErr := errors.New("some issue") diff --git a/core/services/pipeline/variables_test.go b/core/services/pipeline/variables_test.go index fad23d38383..13316047edc 100644 --- a/core/services/pipeline/variables_test.go +++ b/core/services/pipeline/variables_test.go @@ -31,6 +31,7 @@ func TestVars_Get(t *testing.T) { t.Parallel() t.Run("gets the values at keypaths that exist", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": []any{1, "bar", false}, "bar": 321, @@ -46,6 +47,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("gets the value for a keypath with more than 2 parts", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{ "bar": map[string]any{ @@ -59,6 +61,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("gets the value with indices in the keypath", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": []any{ nil, @@ -73,6 +76,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("errors when getting the values at keypaths that don't exist", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": []any{1, "bar", false}, "bar": 321, @@ -83,6 +87,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("errors when getting a value at a keypath where the first part is not a map/slice", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": 123, }) @@ -91,6 +96,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("errors when getting a value at a keypath where the second part is not a map/slice", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{ "bar": 123, @@ -101,6 +107,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("errors when using a keypath with empty segments", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": map[string]any{ "bar": 123, @@ -111,6 +118,7 @@ func TestVars_Get(t *testing.T) { }) t.Run("index out of range", func(t *testing.T) { + t.Parallel() vars := pipeline.NewVarsFrom(map[string]any{ "foo": []any{1, "bar", false}, })