From 9f736f1b1647b82f2db1a55b133e2e1c743f5d38 Mon Sep 17 00:00:00 2001 From: Bojan Zivanovic Date: Mon, 8 Apr 2024 19:44:41 +0200 Subject: [PATCH] Fix broken test assertions. --- nanoq_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nanoq_test.go b/nanoq_test.go index 50b95ec..5e1385e 100644 --- a/nanoq_test.go +++ b/nanoq_test.go @@ -257,7 +257,7 @@ func TestProcessor_Run_SkipRetry(t *testing.T) { }) errorHandlerCalled := 0 processor.OnError(func(ctx context.Context, task nanoq.Task, err error) { - if !errors.Is(err, nanoq.ErrSkipRetry) && !strings.Contains("something terrible happened", err.Error()) { + if !errors.Is(err, nanoq.ErrSkipRetry) || !strings.Contains(err.Error(), "something terrible happened") { t.Errorf("error handler called with unexpected error: %v", err) } errorHandlerCalled++ @@ -298,7 +298,7 @@ func TestProcessor_Run_Panic(t *testing.T) { }) errorHandlerCalled := 0 processor.OnError(func(ctx context.Context, task nanoq.Task, err error) { - if !errors.Is(err, nanoq.ErrSkipRetry) && !strings.Contains("oh no", err.Error()) { + if !errors.Is(err, nanoq.ErrSkipRetry) || !strings.Contains(err.Error(), "oh no") { t.Errorf("error handler called with unexpected error: %v", err) } errorHandlerCalled++ @@ -336,7 +336,7 @@ func TestProcessor_Run_NoHandler(t *testing.T) { processor := nanoq.NewProcessor(client, zerolog.Nop()) errorHandlerCalled := 0 processor.OnError(func(ctx context.Context, task nanoq.Task, err error) { - if !errors.Is(err, nanoq.ErrSkipRetry) && !strings.Contains("no handler found for task type my-type", err.Error()) { + if !errors.Is(err, nanoq.ErrSkipRetry) || !strings.Contains(err.Error(), "no handler found for task type my-type") { t.Errorf("error handler called with unexpected error: %v", err) } errorHandlerCalled++