Skip to content

Commit

Permalink
Adjust matchers after #208: modify error handling in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vnxme committed Aug 16, 2024
1 parent e350826 commit cf0adbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion modules/l4dns/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package l4dns

import (
"context"
"errors"
"io"
"net"
"testing"
Expand All @@ -28,7 +29,7 @@ import (

func assertNoError(t *testing.T, err error) {
t.Helper()
if err != nil {
if err != nil && !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrUnexpectedEOF) {
t.Fatalf("Unexpected error: %s\n", err)
}
}
Expand Down
3 changes: 2 additions & 1 deletion modules/l4rdp/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package l4rdp
import (
"bytes"
"context"
"errors"
"io"
"net"
"testing"
Expand All @@ -29,7 +30,7 @@ import (

func assertNoError(t *testing.T, err error) {
t.Helper()
if err != nil {
if err != nil && !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrUnexpectedEOF) {
t.Fatalf("Unexpected error: %s\n", err)
}
}
Expand Down
6 changes: 4 additions & 2 deletions modules/l4regexp/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ package l4regexp

import (
"context"
"errors"
"io"
"net"
"testing"

"github.com/caddyserver/caddy/v2"
"github.com/mholt/caddy-l4/layer4"
"go.uber.org/zap"

"github.com/mholt/caddy-l4/layer4"
)

func assertNoError(t *testing.T, err error) {
t.Helper()
if err != nil {
if err != nil && !errors.Is(err, io.EOF) && !errors.Is(err, io.ErrUnexpectedEOF) {
t.Fatalf("Unexpected error: %s\n", err)
}
}
Expand Down

0 comments on commit cf0adbf

Please sign in to comment.