mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tests: additional remaining errors.Is
Signed-off-by: redwrasse <mail@redwrasse.io>
This commit is contained in:
parent
1af229b866
commit
26d26d0cec
@ -304,7 +304,7 @@ func testMaintenanceSnapshotErrorInflight(t *testing.T, snapshot func(context.Co
|
|||||||
close(donec)
|
close(donec)
|
||||||
}()
|
}()
|
||||||
_, err = io.Copy(io.Discard, rc1)
|
_, 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)
|
t.Errorf("expected %v, got %v", context.Canceled, err)
|
||||||
}
|
}
|
||||||
<-donec
|
<-donec
|
||||||
|
|||||||
@ -16,6 +16,7 @@ package clientv3test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"reflect"
|
"reflect"
|
||||||
@ -809,7 +810,7 @@ func TestWatchAfterClose(t *testing.T) {
|
|||||||
donec := make(chan struct{})
|
donec := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
cli.Watch(context.TODO(), "foo")
|
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)
|
t.Errorf("expected %v, got %v", context.Canceled, err)
|
||||||
}
|
}
|
||||||
close(donec)
|
close(donec)
|
||||||
|
|||||||
@ -1562,7 +1562,7 @@ func TestTLSGRPCRejectInsecureClient(t *testing.T) {
|
|||||||
// nil out TLS field so client will use an insecure connection
|
// nil out TLS field so client will use an insecure connection
|
||||||
clus.Members[0].ClientTLSInfo = nil
|
clus.Members[0].ClientTLSInfo = nil
|
||||||
client, err := integration.NewClientV3(clus.Members[0])
|
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)
|
t.Fatalf("unexpected error (%v)", err)
|
||||||
} else if client == nil {
|
} else if client == nil {
|
||||||
// Ideally, no client would be returned. However, grpc will
|
// Ideally, no client would be returned. However, grpc will
|
||||||
|
|||||||
@ -1086,7 +1086,7 @@ func testV3LeaseTimeToLiveWithLeaderChanged(t *testing.T, fpName string) {
|
|||||||
require.NoError(t, gofail.Enable(fpName, `sleep("3s")`))
|
require.NoError(t, gofail.Enable(fpName, `sleep("3s")`))
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
terr := gofail.Disable(fpName)
|
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)
|
t.Fatalf("failed to disable %s: %v", fpName, terr)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user