all: fix warning flagging the use of DeepEqual on error (#23624)
* core: fix warning flagging the use of DeepEqual on error * apply the same change everywhere possible * revert change that was committed by mistake * fix build error * Update config.go * revert changes to ConfigCompatError * review feedback Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
@ -370,6 +370,8 @@ func TestServerSetupConn(t *testing.T) {
|
||||
clientkey, srvkey = newkey(), newkey()
|
||||
clientpub = &clientkey.PublicKey
|
||||
srvpub = &srvkey.PublicKey
|
||||
fooErr = errors.New("foo")
|
||||
readErr = errors.New("read error")
|
||||
)
|
||||
tests := []struct {
|
||||
dontstart bool
|
||||
@ -387,10 +389,10 @@ func TestServerSetupConn(t *testing.T) {
|
||||
wantCloseErr: errServerStopped,
|
||||
},
|
||||
{
|
||||
tt: &setupTransport{pubkey: clientpub, encHandshakeErr: errors.New("read error")},
|
||||
tt: &setupTransport{pubkey: clientpub, encHandshakeErr: readErr},
|
||||
flags: inboundConn,
|
||||
wantCalls: "doEncHandshake,close,",
|
||||
wantCloseErr: errors.New("read error"),
|
||||
wantCloseErr: readErr,
|
||||
},
|
||||
{
|
||||
tt: &setupTransport{pubkey: clientpub, phs: protoHandshake{ID: randomID().Bytes()}},
|
||||
@ -400,11 +402,11 @@ func TestServerSetupConn(t *testing.T) {
|
||||
wantCloseErr: DiscUnexpectedIdentity,
|
||||
},
|
||||
{
|
||||
tt: &setupTransport{pubkey: clientpub, protoHandshakeErr: errors.New("foo")},
|
||||
tt: &setupTransport{pubkey: clientpub, protoHandshakeErr: fooErr},
|
||||
dialDest: enode.NewV4(clientpub, nil, 0, 0),
|
||||
flags: dynDialedConn,
|
||||
wantCalls: "doEncHandshake,doProtoHandshake,close,",
|
||||
wantCloseErr: errors.New("foo"),
|
||||
wantCloseErr: fooErr,
|
||||
},
|
||||
{
|
||||
tt: &setupTransport{pubkey: srvpub, phs: protoHandshake{ID: crypto.FromECDSAPub(srvpub)[1:]}},
|
||||
@ -443,7 +445,7 @@ func TestServerSetupConn(t *testing.T) {
|
||||
}
|
||||
p1, _ := net.Pipe()
|
||||
srv.SetupConn(p1, test.flags, test.dialDest)
|
||||
if !reflect.DeepEqual(test.tt.closeErr, test.wantCloseErr) {
|
||||
if !errors.Is(test.tt.closeErr, test.wantCloseErr) {
|
||||
t.Errorf("test %d: close error mismatch: got %q, want %q", i, test.tt.closeErr, test.wantCloseErr)
|
||||
}
|
||||
if test.tt.calls != test.wantCalls {
|
||||
|
Reference in New Issue
Block a user