Skip to content

Commit

Permalink
Fix broken test assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojanz committed Apr 8, 2024
1 parent e37dd92 commit 9f736f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nanoq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down Expand Up @@ -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++
Expand Down Expand Up @@ -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++
Expand Down

0 comments on commit 9f736f1

Please sign in to comment.