mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rpctypes: test error equivalence with Error()
grpc.Errorf() now returns *rpcError, which makes comparisons shallow.
This commit is contained in:
parent
f7ec7f025b
commit
4b6f9b79e6
@ -26,15 +26,15 @@ func TestConvert(t *testing.T) {
|
||||
e2 := ErrGRPCEmptyKey
|
||||
e3 := ErrEmptyKey
|
||||
|
||||
if e1 != e2 {
|
||||
t.Fatalf("expected 'true', got %T != %T", e1, e2)
|
||||
if e1.Error() != e2.Error() {
|
||||
t.Fatalf("expected %q == %q", e1.Error(), e2.Error())
|
||||
}
|
||||
if grpc.Code(e1) != e3.(EtcdError).Code() {
|
||||
t.Fatalf("expected them to be equal, got %v / %v", grpc.Code(e1), e3.(EtcdError).Code())
|
||||
}
|
||||
|
||||
if e1 == e3 {
|
||||
t.Fatalf("expected 'false', got %T == %T", e1, e3)
|
||||
if e1.Error() == e3.Error() {
|
||||
t.Fatalf("expected %q != %q", e1.Error(), e3.Error())
|
||||
}
|
||||
if grpc.Code(e2) != e3.(EtcdError).Code() {
|
||||
t.Fatalf("expected them to be equal, got %v / %v", grpc.Code(e2), e3.(EtcdError).Code())
|
||||
|
Loading…
x
Reference in New Issue
Block a user