From b88338d5be42fd4e87374a202d35215d04a18458 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 20 Dec 2024 13:13:36 -0500 Subject: [PATCH 1/2] test: partial revert --- core/internal/cltest/cltest.go | 6 ++---- core/internal/features/ocr2/features_ocr2_helper.go | 6 ++---- core/internal/features/ocr2/features_ocr2_test.go | 6 ++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index b8b34919b6e..a55c57cc9a2 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -999,7 +999,7 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns t.Helper() var pr []pipeline.Run - if !gomega.NewWithT(t).Eventually(func() bool { + gomega.NewWithT(t).Eventually(func() bool { prs, _, err := jo.PipelineRuns(testutils.Context(t), &jobID, 0, 1000) require.NoError(t, err) @@ -1029,9 +1029,7 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns jobID, len(pr), ), - ) { - t.Fatal() - } + ) return pr } diff --git a/core/internal/features/ocr2/features_ocr2_helper.go b/core/internal/features/ocr2/features_ocr2_helper.go index 76056d7d23d..0b547df3b68 100644 --- a/core/internal/features/ocr2/features_ocr2_helper.go +++ b/core/internal/features/ocr2/features_ocr2_helper.go @@ -570,13 +570,11 @@ updateInterval = "1m" // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). - if !gomega.NewGomegaWithT(t).Eventually(func() string { + gomega.NewGomegaWithT(t).Eventually(func() string { answer, err2 := ocrContract.LatestAnswer(nil) require.NoError(t, err2) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) { - t.Fatal() - } + }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) for _, app := range apps { jobs, _, err2 := app.JobORM().FindJobs(ctx, 0, 1000) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index a8a8886c50c..3dcef5c4e8a 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -235,13 +235,11 @@ updateInterval = "1m" wg.Wait() // 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). - if !gomega.NewGomegaWithT(t).Eventually(func() string { + gomega.NewGomegaWithT(t).Eventually(func() string { answer, err := ocrContract.LatestAnswer(nil) require.NoError(t, err) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal("20")) { - t.Fatal() - } + }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal("20")) for _, app := range apps { jobs, _, err := app.JobORM().FindJobs(ctx, 0, 1000) From 648b237dcf6fc1fae85a3dfa607e0dac104e2057 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 20 Dec 2024 13:44:23 -0500 Subject: [PATCH 2/2] test: remove t.Parallel() only --- core/capabilities/compute/compute_test.go | 2 -- core/internal/cltest/cltest.go | 6 ++++-- core/internal/features/ocr2/features_ocr2_helper.go | 6 ++++-- core/internal/features/ocr2/features_ocr2_test.go | 6 ++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/capabilities/compute/compute_test.go b/core/capabilities/compute/compute_test.go index 1b1b6e643e8..3e5f501fa61 100644 --- a/core/capabilities/compute/compute_test.go +++ b/core/capabilities/compute/compute_test.go @@ -77,7 +77,6 @@ func setup(t *testing.T, config Config) testHarness { } func TestComputeStartAddsToRegistry(t *testing.T) { - t.Parallel() th := setup(t, defaultConfig) require.NoError(t, th.compute.Start(tests.Context(t))) @@ -110,7 +109,6 @@ func TestComputeExecuteMissingConfig(t *testing.T) { } func TestComputeExecuteMissingBinary(t *testing.T) { - t.Parallel() th := setup(t, defaultConfig) require.NoError(t, th.compute.Start(tests.Context(t))) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index a55c57cc9a2..b8b34919b6e 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -999,7 +999,7 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns t.Helper() var pr []pipeline.Run - gomega.NewWithT(t).Eventually(func() bool { + if !gomega.NewWithT(t).Eventually(func() bool { prs, _, err := jo.PipelineRuns(testutils.Context(t), &jobID, 0, 1000) require.NoError(t, err) @@ -1029,7 +1029,9 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns jobID, len(pr), ), - ) + ) { + t.Fatal() + } return pr } diff --git a/core/internal/features/ocr2/features_ocr2_helper.go b/core/internal/features/ocr2/features_ocr2_helper.go index 0b547df3b68..76056d7d23d 100644 --- a/core/internal/features/ocr2/features_ocr2_helper.go +++ b/core/internal/features/ocr2/features_ocr2_helper.go @@ -570,11 +570,13 @@ updateInterval = "1m" // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). - gomega.NewGomegaWithT(t).Eventually(func() string { + if !gomega.NewGomegaWithT(t).Eventually(func() string { answer, err2 := ocrContract.LatestAnswer(nil) require.NoError(t, err2) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) + }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) { + t.Fatal() + } for _, app := range apps { jobs, _, err2 := app.JobORM().FindJobs(ctx, 0, 1000) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 3dcef5c4e8a..a8a8886c50c 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -235,11 +235,13 @@ updateInterval = "1m" wg.Wait() // 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). - gomega.NewGomegaWithT(t).Eventually(func() string { + if !gomega.NewGomegaWithT(t).Eventually(func() string { answer, err := ocrContract.LatestAnswer(nil) require.NoError(t, err) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal("20")) + }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal("20")) { + t.Fatal() + } for _, app := range apps { jobs, _, err := app.JobORM().FindJobs(ctx, 0, 1000)