Skip to content

Commit

Permalink
tests: additional remaining errors.Is
Browse files Browse the repository at this point in the history
Signed-off-by: redwrasse <[email protected]>
  • Loading branch information
redwrasse committed Sep 24, 2024
1 parent 1af229b commit 26d26d0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/integration/clientv3/maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func testMaintenanceSnapshotErrorInflight(t *testing.T, snapshot func(context.Co
close(donec)
}()
_, err = io.Copy(io.Discard, rc1)
if err != nil && err != context.Canceled {
if err != nil && !errors.Is(err, context.Canceled) {
t.Errorf("expected %v, got %v", context.Canceled, err)
}
<-donec
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/clientv3/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package clientv3test

import (
"context"
"errors"
"fmt"
"math/rand"
"reflect"
Expand Down Expand Up @@ -809,7 +810,7 @@ func TestWatchAfterClose(t *testing.T) {
donec := make(chan struct{})
go func() {
cli.Watch(context.TODO(), "foo")
if err := cli.Close(); err != nil && err != context.Canceled {
if err := cli.Close(); err != nil && !errors.Is(err, context.Canceled) {
t.Errorf("expected %v, got %v", context.Canceled, err)
}
close(donec)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/v3_grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ func TestTLSGRPCRejectInsecureClient(t *testing.T) {
// nil out TLS field so client will use an insecure connection
clus.Members[0].ClientTLSInfo = nil
client, err := integration.NewClientV3(clus.Members[0])
if err != nil && err != context.DeadlineExceeded {
if err != nil && !errors.Is(err, context.DeadlineExceeded) {
t.Fatalf("unexpected error (%v)", err)
} else if client == nil {
// Ideally, no client would be returned. However, grpc will
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/v3_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ func testV3LeaseTimeToLiveWithLeaderChanged(t *testing.T, fpName string) {
require.NoError(t, gofail.Enable(fpName, `sleep("3s")`))
t.Cleanup(func() {
terr := gofail.Disable(fpName)
if terr != nil && terr != gofail.ErrDisabled {
if terr != nil && !errors.Is(terr, gofail.ErrDisabled) {
t.Fatalf("failed to disable %s: %v", fpName, terr)
}
})
Expand Down

0 comments on commit 26d26d0

Please sign in to comment.