diff options
author | Karthik Nayak <knayak@gitlab.com> | 2023-11-29 19:26:44 +0300 |
---|---|---|
committer | Karthik Nayak <knayak@gitlab.com> | 2023-11-30 18:15:59 +0300 |
commit | 966b9a43ac2ea0dc6a03bc3836597b0e4c2bbb75 (patch) | |
tree | 3d16d979af3f5e96c23c2f9ff60c685ef0c32335 /internal/praefect | |
parent | de8220dfa186ef1d864050db8473f5bc629113ef (diff) |
errors: Use `errors.Is()` for error comparisons
Similar to the previous commit, fix the remaining error comparisons
manually to use errors.Is().
Diffstat (limited to 'internal/praefect')
-rw-r--r-- | internal/praefect/nodes/sql_elector_test.go | 3 | ||||
-rw-r--r-- | internal/praefect/testserver.go | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/internal/praefect/nodes/sql_elector_test.go b/internal/praefect/nodes/sql_elector_test.go index 6c42f8a97..135c03b84 100644 --- a/internal/praefect/nodes/sql_elector_test.go +++ b/internal/praefect/nodes/sql_elector_test.go @@ -2,6 +2,7 @@ package nodes import ( "context" + "errors" "net" "testing" "time" @@ -435,7 +436,7 @@ func TestConnectionMultiplexing(t *testing.T) { grpc.Creds(lm), grpc.UnknownServiceHandler(func(srv interface{}, stream grpc.ServerStream) error { _, err := backchannel.GetPeerID(stream.Context()) - if err == backchannel.ErrNonMultiplexedConnection { + if errors.Is(err, backchannel.ErrNonMultiplexedConnection) { return errNonMuxed } diff --git a/internal/praefect/testserver.go b/internal/praefect/testserver.go index 835b5377d..fc4eb083d 100644 --- a/internal/praefect/testserver.go +++ b/internal/praefect/testserver.go @@ -2,6 +2,7 @@ package praefect import ( "context" + "errors" "fmt" "net" "testing" @@ -153,7 +154,7 @@ func newMockDownstream(tb testing.TB, token string, registerService func(*grpc.S // If the server is shutdown before Serve() is called on it // the Serve() calls will return the ErrServerStopped - if err := <-errQ; err != nil && err != grpc.ErrServerStopped { + if err := <-errQ; err != nil && !errors.Is(err, grpc.ErrServerStopped) { require.NoError(tb, err) } } |