From af7287118522490531cd9e9dec4618ca0e5348b3 Mon Sep 17 00:00:00 2001 From: Thomas Modeneis Date: Tue, 13 Aug 2019 22:44:48 +0200 Subject: [PATCH] fixes #19959 --- p2p/discv5/node_test.go | 6 +++--- p2p/enode/urlv4_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/p2p/discv5/node_test.go b/p2p/discv5/node_test.go index ce4ad9e4d4..6c64cfc0ff 100644 --- a/p2p/discv5/node_test.go +++ b/p2p/discv5/node_test.go @@ -27,6 +27,8 @@ import ( "testing/quick" "time" + "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" ) @@ -152,10 +154,8 @@ func TestParseNode(t *testing.T) { if err == nil { t.Errorf("test %q:\n got nil error, expected %#q", test.rawurl, test.wantError) continue - } else if err.Error() != test.wantError { - t.Errorf("test %q:\n got error %#q, expected %#q", test.rawurl, err.Error(), test.wantError) - continue } + require.Contains(t, err.Error(), test.wantError, "test %q:\n got error %#q, expected %#q", test.rawurl, err.Error(), test.wantError) } else { if err != nil { t.Errorf("test %q:\n unexpected error: %v", test.rawurl, err) diff --git a/p2p/enode/urlv4_test.go b/p2p/enode/urlv4_test.go index 69ed111021..52acf4714a 100644 --- a/p2p/enode/urlv4_test.go +++ b/p2p/enode/urlv4_test.go @@ -23,6 +23,8 @@ import ( "strings" "testing" + "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/enr" ) @@ -162,10 +164,8 @@ func TestParseNode(t *testing.T) { if err == nil { t.Errorf("test %q:\n got nil error, expected %#q", test.input, test.wantError) continue - } else if err.Error() != test.wantError { - t.Errorf("test %q:\n got error %#q, expected %#q", test.input, err.Error(), test.wantError) - continue } + require.Contains(t, err.Error(), test.wantError, "test %q:\n got error %#q, expected %#q", test.input, err.Error(), test.wantError) } else { if err != nil { t.Errorf("test %q:\n unexpected error: %v", test.input, err)