Skip to content

Commit 1c2806f

Browse files
committed
changefeedccl: fix reversed args for containment check in test logic
Fix a testing bug introduced in #131545 where the `Contains` check arguments were reversed. The error string being _searched_ should precede the string being _searched for_. The examples from the API docs: ``` // require.Contains(t, "Hello World", "World") // require.Contains(t, ["Hello", "World"], "World") // require.Contains(t, {"Hello": "World"}, "Hello") ``` Release note: None
1 parent 1fc47a9 commit 1c2806f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/ccl/changefeedccl/changefeedbase/errors_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestAsTerminalError(t *testing.T) {
4646
t.Run("node drain marked as job retry", func(t *testing.T) {
4747
cause := errors.New("some error happened")
4848
termErr := changefeedbase.AsTerminalError(context.Background(), nodeIsDraining, cause)
49-
require.Contains(t, cause.Error(), termErr.Error())
49+
require.Contains(t, termErr.Error(), cause.Error())
5050
require.True(t, jobs.IsRetryJobError(termErr))
5151
})
5252

@@ -55,19 +55,19 @@ func TestAsTerminalError(t *testing.T) {
5555
cause := changefeedbase.WithTerminalError(
5656
changefeedbase.MarkRetryableError(errors.New("confusing error")))
5757
termErr := changefeedbase.AsTerminalError(context.Background(), nodeIsNotDraining, cause)
58-
require.Contains(t, cause.Error(), termErr.Error())
58+
require.Contains(t, termErr.Error(), cause.Error())
5959
})
6060

6161
t.Run("assertion failures are terminal", func(t *testing.T) {
6262
// Assertion failures are terminal, even if marked as retry-able.
6363
cause := changefeedbase.MarkRetryableError(errors.AssertionFailedf("though shall not pass"))
6464
termErr := changefeedbase.AsTerminalError(context.Background(), nodeIsNotDraining, cause)
65-
require.Contains(t, cause.Error(), termErr.Error())
65+
require.Contains(t, termErr.Error(), cause.Error())
6666
})
6767

6868
t.Run("gc error is terminal", func(t *testing.T) {
6969
cause := changefeedbase.MarkRetryableError(&kvpb.BatchTimestampBeforeGCError{})
7070
termErr := changefeedbase.AsTerminalError(context.Background(), nodeIsNotDraining, cause)
71-
require.Contains(t, cause.Error(), termErr.Error())
71+
require.Contains(t, termErr.Error(), cause.Error())
7272
})
7373
}

0 commit comments

Comments
 (0)