From df3f5cf98ec25ef4fb272acb6dd4a570af4459e9 Mon Sep 17 00:00:00 2001 From: Miles Frankel Date: Thu, 14 Nov 2024 12:40:28 -0500 Subject: [PATCH] changefeedccl: bump test timeout The TestChangefeedTimelyResolvedTimestampUpdatePostRollingRestart test has been flaky, on kv's advice I am increasing its timeout. I'm also enabling verbose changefeed logging to help diagnose future issues here. Fixes: #134903 Fixes: #134916 Release note: None --- pkg/ccl/changefeedccl/cdctest/testfeed.go | 3 +++ pkg/ccl/changefeedccl/changefeed_test.go | 5 ++++- pkg/ccl/changefeedccl/testfeed_test.go | 12 +++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/ccl/changefeedccl/cdctest/testfeed.go b/pkg/ccl/changefeedccl/cdctest/testfeed.go index e92d4f0eaea8..bc74c8cccdd7 100644 --- a/pkg/ccl/changefeedccl/cdctest/testfeed.go +++ b/pkg/ccl/changefeedccl/cdctest/testfeed.go @@ -7,6 +7,7 @@ package cdctest import ( "fmt" + "time" "github.com/cockroachdb/cockroach/pkg/jobs" "github.com/cockroachdb/cockroach/pkg/jobs/jobspb" @@ -75,6 +76,8 @@ type EnterpriseTestFeed interface { Resume() error // WaitForStatus waits for the provided func to return true, or returns an error. WaitForStatus(func(s jobs.Status) bool) error + // WaitDurationForStatus waits for a specified time for the provided func to return true, or returns an error. + WaitDurationForStatus(dur time.Duration, statusPred func(status jobs.Status) bool) error // FetchTerminalJobErr retrieves the error message from changefeed job. FetchTerminalJobErr() error // FetchRunningStatus retrieves running status from changefeed job. diff --git a/pkg/ccl/changefeedccl/changefeed_test.go b/pkg/ccl/changefeedccl/changefeed_test.go index 3b9d77e87a92..09db41e327d7 100644 --- a/pkg/ccl/changefeedccl/changefeed_test.go +++ b/pkg/ccl/changefeedccl/changefeed_test.go @@ -6472,6 +6472,9 @@ func TestChangefeedTimelyResolvedTimestampUpdatePostRollingRestart(t *testing.T) defer leaktest.AfterTest(t)() defer log.Scope(t).Close(t) + // Add verbose logging to help debug future failures. + require.NoError(t, log.SetVModule("changefeed_processors=1")) + // This test requires many range splits, which can be slow under certain test // conditions. Skip potentially slow tests. skip.UnderDeadlock(t) @@ -6569,7 +6572,7 @@ func TestChangefeedTimelyResolvedTimestampUpdatePostRollingRestart(t *testing.T) defer DiscardMessages(testFeed)() // Ensure the changefeed is able to complete in a reasonable amount of time. - require.NoError(t, testFeed.(cdctest.EnterpriseTestFeed).WaitForStatus(func(s jobs.Status) bool { + require.NoError(t, testFeed.(cdctest.EnterpriseTestFeed).WaitDurationForStatus(5*time.Minute, func(s jobs.Status) bool { return s == jobs.StatusSucceeded })) } diff --git a/pkg/ccl/changefeedccl/testfeed_test.go b/pkg/ccl/changefeedccl/testfeed_test.go index b3403e23442a..a0be728e0daf 100644 --- a/pkg/ccl/changefeedccl/testfeed_test.go +++ b/pkg/ccl/changefeedccl/testfeed_test.go @@ -440,13 +440,15 @@ func (f *jobFeed) status() (status string, err error) { return } -func (f *jobFeed) WaitForStatus(statusPred func(status jobs.Status) bool) error { +func (f *jobFeed) WaitDurationForStatus( + dur time.Duration, statusPred func(status jobs.Status) bool, +) error { if f.jobID == jobspb.InvalidJobID { // Job may not have been started. return nil } // Wait for the job status predicate to become true. - return testutils.SucceedsSoonError(func() error { + return testutils.SucceedsWithinError(func() error { var status string var err error if status, err = f.status(); err != nil { @@ -456,7 +458,11 @@ func (f *jobFeed) WaitForStatus(statusPred func(status jobs.Status) bool) error return nil } return errors.Newf("still waiting for job status; current %s", status) - }) + }, dur) +} + +func (f *jobFeed) WaitForStatus(statusPred func(status jobs.Status) bool) error { + return f.WaitDurationForStatus(testutils.SucceedsSoonDuration(), statusPred) } // Pause implements the TestFeed interface.