@@ -37,16 +37,16 @@ func TestAsTerminalError(t *testing.T) {
3737
3838 // Regardless of the state of the node drain, or the type of error,
3939 // context error takes precedence.
40- require .Regexp (t , context .Canceled ,
41- changefeedbase .AsTerminalError (canceledCtx , nodeIsDraining , errors .New ("ignored" )))
42- require .Regexp (t , context .Canceled ,
43- changefeedbase .AsTerminalError (canceledCtx , nodeIsNotDraining , errors .New ("ignored" )))
40+ require .Regexp (t , context .Canceled . Error () ,
41+ changefeedbase .AsTerminalError (canceledCtx , nodeIsDraining , errors .New ("ignored" )). Error () )
42+ require .Regexp (t , context .Canceled . Error () ,
43+ changefeedbase .AsTerminalError (canceledCtx , nodeIsNotDraining , errors .New ("ignored" )). Error () )
4444 })
4545
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 .Regexp (t , cause .Error (), termErr )
49+ require .Contains (t , cause .Error (), termErr . 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 .Regexp (t , cause .Error (), termErr )
58+ require .Contains (t , cause .Error (), termErr . 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 .Regexp (t , cause .Error (), termErr )
65+ require .Contains (t , cause .Error (), termErr . 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 .Regexp (t , cause .Error (), termErr )
71+ require .Contains (t , cause .Error (), termErr . Error () )
7272 })
7373}
0 commit comments