From 9a345b5ce83b5526d135e01f043a37a19e609da6 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 07:20:08 +0100 Subject: [PATCH 01/12] travis: Enable ARM support --- .travis.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4acd00bc9f4a..9f3fad6e144d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ language: go go_import_path: github.com/ethereum/go-ethereum sudo: false +arch: + - amd64 + - arch64 jobs: include: # This builder only tests code linters on latest version of Go @@ -34,6 +37,16 @@ jobs: # These are the latest Go versions. - stage: build os: linux + arch: amd64 + dist: xenial + go: 1.13.x + script: + - go run build/ci.go install + - go run build/ci.go test -coverage $TEST_PACKAGES + + - stage: build + os: linux + arch: arm64 dist: xenial go: 1.13.x script: From 4e7b296a48a1a7eb68c740851012fb44c407d789 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 09:45:53 +0100 Subject: [PATCH 02/12] Include fixes from 20039 --- .travis.yml | 3 -- metrics/doc.go | 4 ++ metrics/ewma_test.go | 101 +++++++++++++++++++++-------------------- metrics/sample_test.go | 3 +- 4 files changed, 58 insertions(+), 53 deletions(-) create mode 100644 metrics/doc.go diff --git a/.travis.yml b/.travis.yml index 9f3fad6e144d..c992451c4fdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,6 @@ language: go go_import_path: github.com/ethereum/go-ethereum sudo: false -arch: - - amd64 - - arch64 jobs: include: # This builder only tests code linters on latest version of Go diff --git a/metrics/doc.go b/metrics/doc.go new file mode 100644 index 000000000000..ffce0295fe26 --- /dev/null +++ b/metrics/doc.go @@ -0,0 +1,4 @@ +package metrics + +const Epsilon = 0.0000000000000001 +const EpsilonPercentile = .00000000001 diff --git a/metrics/ewma_test.go b/metrics/ewma_test.go index 0430fbd24725..1a13ce32931e 100644 --- a/metrics/ewma_test.go +++ b/metrics/ewma_test.go @@ -1,6 +1,9 @@ package metrics -import "testing" +import ( + "math" + "testing" +) func BenchmarkEWMA(b *testing.B) { a := NewEWMA1() @@ -15,67 +18,67 @@ func TestEWMA1(t *testing.T) { a := NewEWMA1() a.Update(3) a.Tick() - if rate := a.Rate(); 0.6 != rate { + if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.22072766470286553 != rate { + if rate := a.Rate(); math.Abs(0.22072766470286553-rate) > Epsilon { t.Errorf("1 minute a.Rate(): 0.22072766470286553 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.08120116994196772 != rate { + if rate := a.Rate(); math.Abs(0.08120116994196772-rate) > Epsilon { t.Errorf("2 minute a.Rate(): 0.08120116994196772 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.029872241020718428 != rate { + if rate := a.Rate(); math.Abs(0.029872241020718428-rate) > Epsilon { t.Errorf("3 minute a.Rate(): 0.029872241020718428 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.01098938333324054 != rate { + if rate := a.Rate(); math.Abs(0.01098938333324054-rate) > Epsilon { t.Errorf("4 minute a.Rate(): 0.01098938333324054 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.004042768199451294 != rate { + if rate := a.Rate(); math.Abs(0.004042768199451294-rate) > Epsilon { t.Errorf("5 minute a.Rate(): 0.004042768199451294 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.0014872513059998212 != rate { + if rate := a.Rate(); math.Abs(0.0014872513059998212-rate) > Epsilon { t.Errorf("6 minute a.Rate(): 0.0014872513059998212 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.0005471291793327122 != rate { + if rate := a.Rate(); math.Abs(0.0005471291793327122-rate) > Epsilon { t.Errorf("7 minute a.Rate(): 0.0005471291793327122 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.00020127757674150815 != rate { + if rate := a.Rate(); math.Abs(0.00020127757674150815-rate) > Epsilon { t.Errorf("8 minute a.Rate(): 0.00020127757674150815 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 7.404588245200814e-05 != rate { + if rate := a.Rate(); math.Abs(7.404588245200814e-05-rate) > Epsilon { t.Errorf("9 minute a.Rate(): 7.404588245200814e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 2.7239957857491083e-05 != rate { + if rate := a.Rate(); math.Abs(2.7239957857491083e-05-rate) > Epsilon { t.Errorf("10 minute a.Rate(): 2.7239957857491083e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 1.0021020474147462e-05 != rate { + if rate := a.Rate(); math.Abs(1.0021020474147462e-05-rate) > Epsilon { t.Errorf("11 minute a.Rate(): 1.0021020474147462e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 3.6865274119969525e-06 != rate { + if rate := a.Rate(); math.Abs(3.6865274119969525e-06-rate) > Epsilon { t.Errorf("12 minute a.Rate(): 3.6865274119969525e-06 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 1.3561976441886433e-06 != rate { + if rate := a.Rate(); math.Abs(1.3561976441886433e-06-rate) > Epsilon { t.Errorf("13 minute a.Rate(): 1.3561976441886433e-06 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 4.989172314621449e-07 != rate { + if rate := a.Rate(); math.Abs(4.989172314621449e-07-rate) > Epsilon { t.Errorf("14 minute a.Rate(): 4.989172314621449e-07 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 1.8354139230109722e-07 != rate { + if rate := a.Rate(); math.Abs(1.8354139230109722e-07-rate) > Epsilon { t.Errorf("15 minute a.Rate(): 1.8354139230109722e-07 != %v\n", rate) } } @@ -84,67 +87,67 @@ func TestEWMA5(t *testing.T) { a := NewEWMA5() a.Update(3) a.Tick() - if rate := a.Rate(); 0.6 != rate { + if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.49123845184678905 != rate { + if rate := a.Rate(); math.Abs(0.49123845184678905-rate) > Epsilon { t.Errorf("1 minute a.Rate(): 0.49123845184678905 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.4021920276213837 != rate { + if rate := a.Rate(); math.Abs(0.4021920276213837-rate) > Epsilon { t.Errorf("2 minute a.Rate(): 0.4021920276213837 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.32928698165641596 != rate { + if rate := a.Rate(); math.Abs(0.32928698165641596-rate) > Epsilon { t.Errorf("3 minute a.Rate(): 0.32928698165641596 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.269597378470333 != rate { + if rate := a.Rate(); math.Abs(0.269597378470333-rate) > Epsilon { t.Errorf("4 minute a.Rate(): 0.269597378470333 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.2207276647028654 != rate { + if rate := a.Rate(); math.Abs(0.2207276647028654-rate) > Epsilon { t.Errorf("5 minute a.Rate(): 0.2207276647028654 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.18071652714732128 != rate { + if rate := a.Rate(); math.Abs(0.18071652714732128-rate) > Epsilon { t.Errorf("6 minute a.Rate(): 0.18071652714732128 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.14795817836496392 != rate { + if rate := a.Rate(); math.Abs(0.14795817836496392-rate) > Epsilon { t.Errorf("7 minute a.Rate(): 0.14795817836496392 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.12113791079679326 != rate { + if rate := a.Rate(); math.Abs(0.12113791079679326-rate) > Epsilon { t.Errorf("8 minute a.Rate(): 0.12113791079679326 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.09917933293295193 != rate { + if rate := a.Rate(); math.Abs(0.09917933293295193-rate) > Epsilon { t.Errorf("9 minute a.Rate(): 0.09917933293295193 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.08120116994196763 != rate { + if rate := a.Rate(); math.Abs(0.08120116994196763-rate) > Epsilon { t.Errorf("10 minute a.Rate(): 0.08120116994196763 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.06648189501740036 != rate { + if rate := a.Rate(); math.Abs(0.06648189501740036-rate) > Epsilon { t.Errorf("11 minute a.Rate(): 0.06648189501740036 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.05443077197364752 != rate { + if rate := a.Rate(); math.Abs(0.05443077197364752-rate) > Epsilon { t.Errorf("12 minute a.Rate(): 0.05443077197364752 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.04456414692860035 != rate { + if rate := a.Rate(); math.Abs(0.04456414692860035-rate) > Epsilon { t.Errorf("13 minute a.Rate(): 0.04456414692860035 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.03648603757513079 != rate { + if rate := a.Rate(); math.Abs(0.03648603757513079-rate) > Epsilon { t.Errorf("14 minute a.Rate(): 0.03648603757513079 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.0298722410207183831020718428 != rate { + if rate := a.Rate(); math.Abs(0.0298722410207183831020718428-rate) > Epsilon { t.Errorf("15 minute a.Rate(): 0.0298722410207183831020718428 != %v\n", rate) } } @@ -153,67 +156,67 @@ func TestEWMA15(t *testing.T) { a := NewEWMA15() a.Update(3) a.Tick() - if rate := a.Rate(); 0.6 != rate { + if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.5613041910189706 != rate { + if rate := a.Rate(); math.Abs(0.5613041910189706-rate) > Epsilon { t.Errorf("1 minute a.Rate(): 0.5613041910189706 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.5251039914257684 != rate { + if rate := a.Rate(); math.Abs(0.5251039914257684-rate) > Epsilon { t.Errorf("2 minute a.Rate(): 0.5251039914257684 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.4912384518467888184678905 != rate { + if rate := a.Rate(); math.Abs(0.4912384518467888184678905-rate) > Epsilon { t.Errorf("3 minute a.Rate(): 0.4912384518467888184678905 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.459557003018789 != rate { + if rate := a.Rate(); math.Abs(0.459557003018789-rate) > Epsilon { t.Errorf("4 minute a.Rate(): 0.459557003018789 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.4299187863442732 != rate { + if rate := a.Rate(); math.Abs(0.4299187863442732-rate) > Epsilon { t.Errorf("5 minute a.Rate(): 0.4299187863442732 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.4021920276213831 != rate { + if rate := a.Rate(); math.Abs(0.4021920276213831-rate) > Epsilon { t.Errorf("6 minute a.Rate(): 0.4021920276213831 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.37625345116383313 != rate { + if rate := a.Rate(); math.Abs(0.37625345116383313-rate) > Epsilon { t.Errorf("7 minute a.Rate(): 0.37625345116383313 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.3519877317060185 != rate { + if rate := a.Rate(); math.Abs(0.3519877317060185-rate) > Epsilon { t.Errorf("8 minute a.Rate(): 0.3519877317060185 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.3292869816564153165641596 != rate { + if rate := a.Rate(); math.Abs(0.3292869816564153165641596-rate) > Epsilon { t.Errorf("9 minute a.Rate(): 0.3292869816564153165641596 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.3080502714195546 != rate { + if rate := a.Rate(); math.Abs(0.3080502714195546-rate) > Epsilon { t.Errorf("10 minute a.Rate(): 0.3080502714195546 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.2881831806538789 != rate { + if rate := a.Rate(); math.Abs(0.2881831806538789-rate) > Epsilon { t.Errorf("11 minute a.Rate(): 0.2881831806538789 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.26959737847033216 != rate { + if rate := a.Rate(); math.Abs(0.26959737847033216-rate) > Epsilon { t.Errorf("12 minute a.Rate(): 0.26959737847033216 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.2522102307052083 != rate { + if rate := a.Rate(); math.Abs(0.2522102307052083-rate) > Epsilon { t.Errorf("13 minute a.Rate(): 0.2522102307052083 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.23594443252115815 != rate { + if rate := a.Rate(); math.Abs(0.23594443252115815-rate) > Epsilon { t.Errorf("14 minute a.Rate(): 0.23594443252115815 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); 0.2207276647028646247028654470286553 != rate { + if rate := a.Rate(); math.Abs(0.2207276647028646247028654470286553-rate) > Epsilon { t.Errorf("15 minute a.Rate(): 0.2207276647028646247028654470286553 != %v\n", rate) } } diff --git a/metrics/sample_test.go b/metrics/sample_test.go index d60e99c5bba7..6c8903351165 100644 --- a/metrics/sample_test.go +++ b/metrics/sample_test.go @@ -1,6 +1,7 @@ package metrics import ( + "math" "math/rand" "runtime" "testing" @@ -326,7 +327,7 @@ func testUniformSampleStatistics(t *testing.T, s Sample) { if 7380.5 != ps[1] { t.Errorf("75th percentile: 7380.5 != %v\n", ps[1]) } - if 9986.429999999998 != ps[2] { + if math.Abs(9986.429999999998-ps[2]) > EpsilonPercentile { t.Errorf("99th percentile: 9986.429999999998 != %v\n", ps[2]) } } From a97be2e77b1339c6550dbbcfda5f3e07e74eb275 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 11:12:05 +0100 Subject: [PATCH 03/12] Add a trace to debug the invalid lookup issue --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c992451c4fdd..feb85676eb2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,7 @@ jobs: dist: xenial go: 1.13.x script: + - export GODEBUG=netdns=go+1 - go run build/ci.go install - go run build/ci.go test -coverage $TEST_PACKAGES From 7726f53361ac02037930a2de0f2d6c7089d4352b Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 13:35:49 +0100 Subject: [PATCH 04/12] Try increasing the timeout to see if the arm test passes --- miner/worker_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/worker_test.go b/miner/worker_test.go index faebee1a72df..40822ee2b4e7 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -340,7 +340,7 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens } } w.fullTaskHook = func() { - time.Sleep(100 * time.Millisecond) + time.Sleep(1000 * time.Millisecond) } // Ensure worker has finished initialization From 9d3efde2a82163d120b76a264a880b5ed3d6f989 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 14:10:11 +0100 Subject: [PATCH 05/12] Investigate the resolver issue --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index feb85676eb2a..9db482a01f21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ jobs: dist: xenial go: 1.13.x script: - - export GODEBUG=netdns=go+1 + - export GODEBUG=netdns=cgo - go run build/ci.go install - go run build/ci.go test -coverage $TEST_PACKAGES From f87c2746d7309cab3cdecf58a254737953187a0a Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Wed, 30 Oct 2019 14:15:07 +0100 Subject: [PATCH 06/12] Increase arm64 timeout for clique test --- miner/worker_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/miner/worker_test.go b/miner/worker_test.go index 40822ee2b4e7..adaf25bf6a90 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -19,6 +19,7 @@ package miner import ( "math/big" "math/rand" + "runtime" "testing" "time" @@ -340,7 +341,13 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens } } w.fullTaskHook = func() { - time.Sleep(1000 * time.Millisecond) + // Aarch64 unit tests are running in a VM on travis, they must + // be given more time to execute. + if runtime.GOARCH == "arm64" { + time.Sleep(1000 * time.Millisecond) + } else { + time.Sleep(100 * time.Millisecond) + } } // Ensure worker has finished initialization From 7d56acbda4b06ab3fbee391466a5ac5df8c47be6 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Thu, 31 Oct 2019 06:58:39 +0100 Subject: [PATCH 07/12] increase timeout in tests for arm64 --- .travis.yml | 3 ++- consensus/ethash/ethash_test.go | 9 ++++++++- eth/handler_test.go | 9 ++++++++- miner/worker_test.go | 9 ++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9db482a01f21..b37476ec8da3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,8 +46,9 @@ jobs: arch: arm64 dist: xenial go: 1.13.x + env: + - GODEBUG="netdns=cgo" script: - - export GODEBUG=netdns=cgo - go run build/ci.go install - go run build/ci.go test -coverage $TEST_PACKAGES diff --git a/consensus/ethash/ethash_test.go b/consensus/ethash/ethash_test.go index 90cb6470f735..260a173ddea7 100644 --- a/consensus/ethash/ethash_test.go +++ b/consensus/ethash/ethash_test.go @@ -21,6 +21,7 @@ import ( "math/big" "math/rand" "os" + "runtime" "sync" "testing" "time" @@ -32,6 +33,12 @@ import ( // Tests that ethash works correctly in test mode. func TestTestMode(t *testing.T) { + var timeoutS time.Duration + if runtime.GOARCH == "arm64" { + timeoutS = 2 * time.Second + } else { + timeoutS = time.Second + } header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)} ethash := NewTester(nil, false) @@ -49,7 +56,7 @@ func TestTestMode(t *testing.T) { if err := ethash.VerifySeal(nil, header); err != nil { t.Fatalf("unexpected verification error: %v", err) } - case <-time.NewTimer(time.Second).C: + case <-time.NewTimer(timeoutS).C: t.Error("sealing result timeout") } } diff --git a/eth/handler_test.go b/eth/handler_test.go index 256883d1f067..6c950872d1b2 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -21,6 +21,7 @@ import ( "math" "math/big" "math/rand" + "runtime" "testing" "time" @@ -608,7 +609,13 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) { } }(peer) } - timeout := time.After(300 * time.Millisecond) + var timeoutMs time.Duration + if runtime.GOARCH == "arm64" { + timeoutMs = time.Second + } else { + timeoutMs = 300 * time.Millisecond + } + timeout := time.After(timeoutMs) var receivedCount int outer: for { diff --git a/miner/worker_test.go b/miner/worker_test.go index adaf25bf6a90..68aabb936324 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -358,11 +358,18 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens } } + var timeoutS time.Duration + if runtime.GOARCH == "arm64" { + timeoutS = 4 * time.Second + } else { + timeoutS = 2 * time.Second + } + w.start() for i := 0; i < 2; i += 1 { select { case <-taskCh: - case <-time.NewTimer(2 * time.Second).C: + case <-time.NewTimer(timeoutS).C: t.Error("new task timeout") } } From 4006714b3fe09124b8d9c44312e96d6642c1b986 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Fri, 1 Nov 2019 10:29:47 +0100 Subject: [PATCH 08/12] Only test the failing tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b37476ec8da3..1a566b77cf48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ jobs: - GODEBUG="netdns=cgo" script: - go run build/ci.go install - - go run build/ci.go test -coverage $TEST_PACKAGES + - go run build/ci.go test -coverage ./p2p/enode/... - stage: build os: osx From d7187b285d2e6ab84fb724be09c6e50566c3562a Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Fri, 1 Nov 2019 14:09:52 +0100 Subject: [PATCH 09/12] Review feedback: don't export epsilon --- .travis.yml | 9 +++- build/ci.go | 2 +- investigate/dns_test.go | 14 ++++++ metrics/doc.go | 4 +- metrics/ewma_test.go | 96 ++++++++++++++++++++--------------------- metrics/sample_test.go | 2 +- 6 files changed, 74 insertions(+), 53 deletions(-) create mode 100644 investigate/dns_test.go diff --git a/.travis.yml b/.travis.yml index 1a566b77cf48..1f0c8f8f9456 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,15 @@ jobs: dist: xenial go: 1.13.x env: - - GODEBUG="netdns=cgo" + - GODEBUG="netdns=go+1" script: + - echo "test dns" + - cat /etc/resolv.conf + - ping -c 4 8.8.8.8 + - ping -c 4 8.8.4.4 + - ping -c 4 1.1.1.1 + - ip address + - go test -v ./investigate/... - go run build/ci.go install - go run build/ci.go test -coverage ./p2p/enode/... diff --git a/build/ci.go b/build/ci.go index ac5c72b6b151..04ed2517628c 100644 --- a/build/ci.go +++ b/build/ci.go @@ -327,7 +327,7 @@ func doTest(cmdline []string) { // Test a single package at a time. CI builders are slow // and some tests run into timeouts under load. gotest := goTool("test", buildFlags(env)...) - gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m", "--short") + gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m", "--short", "-v") if *coverage { gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover") } diff --git a/investigate/dns_test.go b/investigate/dns_test.go new file mode 100644 index 000000000000..a8d24966e662 --- /dev/null +++ b/investigate/dns_test.go @@ -0,0 +1,14 @@ +package investigate + +import ( + "fmt" + "net" + "testing" +) + +func TestDNS(t *testing.T) { + for i := 0; i < 100; i++ { + ips, err := net.LookupIP("invalid.") + fmt.Println(i, "result", ips, "err", err) + } +} diff --git a/metrics/doc.go b/metrics/doc.go index ffce0295fe26..13f429c1689d 100644 --- a/metrics/doc.go +++ b/metrics/doc.go @@ -1,4 +1,4 @@ package metrics -const Epsilon = 0.0000000000000001 -const EpsilonPercentile = .00000000001 +const epsilon = 0.0000000000000001 +const epsilonPercentile = .00000000001 diff --git a/metrics/ewma_test.go b/metrics/ewma_test.go index 1a13ce32931e..5b244191616e 100644 --- a/metrics/ewma_test.go +++ b/metrics/ewma_test.go @@ -18,67 +18,67 @@ func TestEWMA1(t *testing.T) { a := NewEWMA1() a.Update(3) a.Tick() - if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.6-rate) > epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.22072766470286553-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.22072766470286553-rate) > epsilon { t.Errorf("1 minute a.Rate(): 0.22072766470286553 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.08120116994196772-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.08120116994196772-rate) > epsilon { t.Errorf("2 minute a.Rate(): 0.08120116994196772 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.029872241020718428-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.029872241020718428-rate) > epsilon { t.Errorf("3 minute a.Rate(): 0.029872241020718428 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.01098938333324054-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.01098938333324054-rate) > epsilon { t.Errorf("4 minute a.Rate(): 0.01098938333324054 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.004042768199451294-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.004042768199451294-rate) > epsilon { t.Errorf("5 minute a.Rate(): 0.004042768199451294 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.0014872513059998212-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.0014872513059998212-rate) > epsilon { t.Errorf("6 minute a.Rate(): 0.0014872513059998212 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.0005471291793327122-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.0005471291793327122-rate) > epsilon { t.Errorf("7 minute a.Rate(): 0.0005471291793327122 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.00020127757674150815-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.00020127757674150815-rate) > epsilon { t.Errorf("8 minute a.Rate(): 0.00020127757674150815 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(7.404588245200814e-05-rate) > Epsilon { + if rate := a.Rate(); math.Abs(7.404588245200814e-05-rate) > epsilon { t.Errorf("9 minute a.Rate(): 7.404588245200814e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(2.7239957857491083e-05-rate) > Epsilon { + if rate := a.Rate(); math.Abs(2.7239957857491083e-05-rate) > epsilon { t.Errorf("10 minute a.Rate(): 2.7239957857491083e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(1.0021020474147462e-05-rate) > Epsilon { + if rate := a.Rate(); math.Abs(1.0021020474147462e-05-rate) > epsilon { t.Errorf("11 minute a.Rate(): 1.0021020474147462e-05 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(3.6865274119969525e-06-rate) > Epsilon { + if rate := a.Rate(); math.Abs(3.6865274119969525e-06-rate) > epsilon { t.Errorf("12 minute a.Rate(): 3.6865274119969525e-06 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(1.3561976441886433e-06-rate) > Epsilon { + if rate := a.Rate(); math.Abs(1.3561976441886433e-06-rate) > epsilon { t.Errorf("13 minute a.Rate(): 1.3561976441886433e-06 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(4.989172314621449e-07-rate) > Epsilon { + if rate := a.Rate(); math.Abs(4.989172314621449e-07-rate) > epsilon { t.Errorf("14 minute a.Rate(): 4.989172314621449e-07 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(1.8354139230109722e-07-rate) > Epsilon { + if rate := a.Rate(); math.Abs(1.8354139230109722e-07-rate) > epsilon { t.Errorf("15 minute a.Rate(): 1.8354139230109722e-07 != %v\n", rate) } } @@ -87,67 +87,67 @@ func TestEWMA5(t *testing.T) { a := NewEWMA5() a.Update(3) a.Tick() - if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.6-rate) > epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.49123845184678905-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.49123845184678905-rate) > epsilon { t.Errorf("1 minute a.Rate(): 0.49123845184678905 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.4021920276213837-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.4021920276213837-rate) > epsilon { t.Errorf("2 minute a.Rate(): 0.4021920276213837 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.32928698165641596-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.32928698165641596-rate) > epsilon { t.Errorf("3 minute a.Rate(): 0.32928698165641596 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.269597378470333-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.269597378470333-rate) > epsilon { t.Errorf("4 minute a.Rate(): 0.269597378470333 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.2207276647028654-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.2207276647028654-rate) > epsilon { t.Errorf("5 minute a.Rate(): 0.2207276647028654 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.18071652714732128-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.18071652714732128-rate) > epsilon { t.Errorf("6 minute a.Rate(): 0.18071652714732128 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.14795817836496392-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.14795817836496392-rate) > epsilon { t.Errorf("7 minute a.Rate(): 0.14795817836496392 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.12113791079679326-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.12113791079679326-rate) > epsilon { t.Errorf("8 minute a.Rate(): 0.12113791079679326 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.09917933293295193-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.09917933293295193-rate) > epsilon { t.Errorf("9 minute a.Rate(): 0.09917933293295193 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.08120116994196763-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.08120116994196763-rate) > epsilon { t.Errorf("10 minute a.Rate(): 0.08120116994196763 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.06648189501740036-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.06648189501740036-rate) > epsilon { t.Errorf("11 minute a.Rate(): 0.06648189501740036 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.05443077197364752-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.05443077197364752-rate) > epsilon { t.Errorf("12 minute a.Rate(): 0.05443077197364752 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.04456414692860035-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.04456414692860035-rate) > epsilon { t.Errorf("13 minute a.Rate(): 0.04456414692860035 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.03648603757513079-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.03648603757513079-rate) > epsilon { t.Errorf("14 minute a.Rate(): 0.03648603757513079 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.0298722410207183831020718428-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.0298722410207183831020718428-rate) > epsilon { t.Errorf("15 minute a.Rate(): 0.0298722410207183831020718428 != %v\n", rate) } } @@ -156,67 +156,67 @@ func TestEWMA15(t *testing.T) { a := NewEWMA15() a.Update(3) a.Tick() - if rate := a.Rate(); math.Abs(0.6-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.6-rate) > epsilon { t.Errorf("initial a.Rate(): 0.6 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.5613041910189706-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.5613041910189706-rate) > epsilon { t.Errorf("1 minute a.Rate(): 0.5613041910189706 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.5251039914257684-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.5251039914257684-rate) > epsilon { t.Errorf("2 minute a.Rate(): 0.5251039914257684 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.4912384518467888184678905-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.4912384518467888184678905-rate) > epsilon { t.Errorf("3 minute a.Rate(): 0.4912384518467888184678905 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.459557003018789-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.459557003018789-rate) > epsilon { t.Errorf("4 minute a.Rate(): 0.459557003018789 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.4299187863442732-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.4299187863442732-rate) > epsilon { t.Errorf("5 minute a.Rate(): 0.4299187863442732 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.4021920276213831-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.4021920276213831-rate) > epsilon { t.Errorf("6 minute a.Rate(): 0.4021920276213831 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.37625345116383313-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.37625345116383313-rate) > epsilon { t.Errorf("7 minute a.Rate(): 0.37625345116383313 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.3519877317060185-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.3519877317060185-rate) > epsilon { t.Errorf("8 minute a.Rate(): 0.3519877317060185 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.3292869816564153165641596-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.3292869816564153165641596-rate) > epsilon { t.Errorf("9 minute a.Rate(): 0.3292869816564153165641596 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.3080502714195546-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.3080502714195546-rate) > epsilon { t.Errorf("10 minute a.Rate(): 0.3080502714195546 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.2881831806538789-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.2881831806538789-rate) > epsilon { t.Errorf("11 minute a.Rate(): 0.2881831806538789 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.26959737847033216-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.26959737847033216-rate) > epsilon { t.Errorf("12 minute a.Rate(): 0.26959737847033216 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.2522102307052083-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.2522102307052083-rate) > epsilon { t.Errorf("13 minute a.Rate(): 0.2522102307052083 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.23594443252115815-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.23594443252115815-rate) > epsilon { t.Errorf("14 minute a.Rate(): 0.23594443252115815 != %v\n", rate) } elapseMinute(a) - if rate := a.Rate(); math.Abs(0.2207276647028646247028654470286553-rate) > Epsilon { + if rate := a.Rate(); math.Abs(0.2207276647028646247028654470286553-rate) > epsilon { t.Errorf("15 minute a.Rate(): 0.2207276647028646247028654470286553 != %v\n", rate) } } diff --git a/metrics/sample_test.go b/metrics/sample_test.go index 6c8903351165..7bab0e3de83d 100644 --- a/metrics/sample_test.go +++ b/metrics/sample_test.go @@ -327,7 +327,7 @@ func testUniformSampleStatistics(t *testing.T, s Sample) { if 7380.5 != ps[1] { t.Errorf("75th percentile: 7380.5 != %v\n", ps[1]) } - if math.Abs(9986.429999999998-ps[2]) > EpsilonPercentile { + if math.Abs(9986.429999999998-ps[2]) > epsilonPercentile { t.Errorf("99th percentile: 9986.429999999998 != %v\n", ps[2]) } } From 486eb97e87fa436bdcb82ef8660b3349651aac93 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Tue, 5 Nov 2019 11:57:06 +0100 Subject: [PATCH 10/12] Remove investigation tricks+include fjl's feeback --- .travis.yml | 11 +---------- build/ci.go | 2 +- consensus/ethash/ethash_test.go | 9 +-------- eth/handler_test.go | 9 +-------- investigate/dns_test.go | 14 -------------- miner/worker_test.go | 16 ++-------------- p2p/enode/urlv4.go | 2 ++ 7 files changed, 8 insertions(+), 55 deletions(-) delete mode 100644 investigate/dns_test.go diff --git a/.travis.yml b/.travis.yml index 1f0c8f8f9456..c992451c4fdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,18 +46,9 @@ jobs: arch: arm64 dist: xenial go: 1.13.x - env: - - GODEBUG="netdns=go+1" script: - - echo "test dns" - - cat /etc/resolv.conf - - ping -c 4 8.8.8.8 - - ping -c 4 8.8.4.4 - - ping -c 4 1.1.1.1 - - ip address - - go test -v ./investigate/... - go run build/ci.go install - - go run build/ci.go test -coverage ./p2p/enode/... + - go run build/ci.go test -coverage $TEST_PACKAGES - stage: build os: osx diff --git a/build/ci.go b/build/ci.go index 04ed2517628c..ac5c72b6b151 100644 --- a/build/ci.go +++ b/build/ci.go @@ -327,7 +327,7 @@ func doTest(cmdline []string) { // Test a single package at a time. CI builders are slow // and some tests run into timeouts under load. gotest := goTool("test", buildFlags(env)...) - gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m", "--short", "-v") + gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m", "--short") if *coverage { gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover") } diff --git a/consensus/ethash/ethash_test.go b/consensus/ethash/ethash_test.go index 260a173ddea7..fdfd81320f96 100644 --- a/consensus/ethash/ethash_test.go +++ b/consensus/ethash/ethash_test.go @@ -21,7 +21,6 @@ import ( "math/big" "math/rand" "os" - "runtime" "sync" "testing" "time" @@ -33,12 +32,6 @@ import ( // Tests that ethash works correctly in test mode. func TestTestMode(t *testing.T) { - var timeoutS time.Duration - if runtime.GOARCH == "arm64" { - timeoutS = 2 * time.Second - } else { - timeoutS = time.Second - } header := &types.Header{Number: big.NewInt(1), Difficulty: big.NewInt(100)} ethash := NewTester(nil, false) @@ -56,7 +49,7 @@ func TestTestMode(t *testing.T) { if err := ethash.VerifySeal(nil, header); err != nil { t.Fatalf("unexpected verification error: %v", err) } - case <-time.NewTimer(timeoutS).C: + case <-time.NewTimer(2 * time.Second).C: t.Error("sealing result timeout") } } diff --git a/eth/handler_test.go b/eth/handler_test.go index 6c950872d1b2..05ddca3efd42 100644 --- a/eth/handler_test.go +++ b/eth/handler_test.go @@ -21,7 +21,6 @@ import ( "math" "math/big" "math/rand" - "runtime" "testing" "time" @@ -609,13 +608,7 @@ func testBroadcastBlock(t *testing.T, totalPeers, broadcastExpected int) { } }(peer) } - var timeoutMs time.Duration - if runtime.GOARCH == "arm64" { - timeoutMs = time.Second - } else { - timeoutMs = 300 * time.Millisecond - } - timeout := time.After(timeoutMs) + timeout := time.After(time.Second) var receivedCount int outer: for { diff --git a/investigate/dns_test.go b/investigate/dns_test.go deleted file mode 100644 index a8d24966e662..000000000000 --- a/investigate/dns_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package investigate - -import ( - "fmt" - "net" - "testing" -) - -func TestDNS(t *testing.T) { - for i := 0; i < 100; i++ { - ips, err := net.LookupIP("invalid.") - fmt.Println(i, "result", ips, "err", err) - } -} diff --git a/miner/worker_test.go b/miner/worker_test.go index 68aabb936324..34f17e8a2432 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -19,7 +19,6 @@ package miner import ( "math/big" "math/rand" - "runtime" "testing" "time" @@ -343,11 +342,7 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens w.fullTaskHook = func() { // Aarch64 unit tests are running in a VM on travis, they must // be given more time to execute. - if runtime.GOARCH == "arm64" { - time.Sleep(1000 * time.Millisecond) - } else { - time.Sleep(100 * time.Millisecond) - } + time.Sleep(time.Second) } // Ensure worker has finished initialization @@ -358,18 +353,11 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens } } - var timeoutS time.Duration - if runtime.GOARCH == "arm64" { - timeoutS = 4 * time.Second - } else { - timeoutS = 2 * time.Second - } - w.start() for i := 0; i < 2; i += 1 { select { case <-taskCh: - case <-time.NewTimer(timeoutS).C: + case <-time.NewTimer(4 * time.Second).C: t.Error("new task timeout") } } diff --git a/p2p/enode/urlv4.go b/p2p/enode/urlv4.go index 2e3f9ba00e6c..3af2ec5e4411 100644 --- a/p2p/enode/urlv4.go +++ b/p2p/enode/urlv4.go @@ -71,12 +71,14 @@ func MustParseV4(rawurl string) *Node { // enode://@10.3.58.6:30303?discport=30301 func ParseV4(rawurl string) (*Node, error) { if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil { + fmt.Println("m != nil") id, err := parsePubkey(m[1]) if err != nil { return nil, fmt.Errorf("invalid public key (%v)", err) } return NewV4(id, nil, 0, 0), nil } + fmt.Println("parse complete") return parseComplete(rawurl) } From 37ff87ec2946c110b517ef48505c9b535c2a2553 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Thu, 7 Nov 2019 16:14:20 +0100 Subject: [PATCH 11/12] Revert the retry ahead of using the mock resolver --- p2p/enode/urlv4_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p2p/enode/urlv4_test.go b/p2p/enode/urlv4_test.go index 33de96cc57f1..4fcb38fdfd3c 100644 --- a/p2p/enode/urlv4_test.go +++ b/p2p/enode/urlv4_test.go @@ -41,6 +41,7 @@ var parseNodeTests = []struct { input string wantError string wantResult *Node + retries uint }{ // Records { @@ -73,6 +74,7 @@ var parseNodeTests = []struct { { input: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@invalid.:3", wantError: `no such host`, + retries: 2, }, { input: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo", @@ -183,6 +185,7 @@ func TestParseNode(t *testing.T) { } if !reflect.DeepEqual(n, test.wantResult) { t.Errorf("test %q:\n result mismatch:\ngot: %#v\nwant: %#v", test.input, n, test.wantResult) + continue } } } From e279338766eed343c5d6468767c23e0d216b2a59 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Thu, 7 Nov 2019 18:38:20 +0100 Subject: [PATCH 12/12] Fix rebase errors --- p2p/enode/urlv4.go | 2 -- p2p/enode/urlv4_test.go | 3 --- 2 files changed, 5 deletions(-) diff --git a/p2p/enode/urlv4.go b/p2p/enode/urlv4.go index 3af2ec5e4411..2e3f9ba00e6c 100644 --- a/p2p/enode/urlv4.go +++ b/p2p/enode/urlv4.go @@ -71,14 +71,12 @@ func MustParseV4(rawurl string) *Node { // enode://@10.3.58.6:30303?discport=30301 func ParseV4(rawurl string) (*Node, error) { if m := incompleteNodeURL.FindStringSubmatch(rawurl); m != nil { - fmt.Println("m != nil") id, err := parsePubkey(m[1]) if err != nil { return nil, fmt.Errorf("invalid public key (%v)", err) } return NewV4(id, nil, 0, 0), nil } - fmt.Println("parse complete") return parseComplete(rawurl) } diff --git a/p2p/enode/urlv4_test.go b/p2p/enode/urlv4_test.go index 4fcb38fdfd3c..33de96cc57f1 100644 --- a/p2p/enode/urlv4_test.go +++ b/p2p/enode/urlv4_test.go @@ -41,7 +41,6 @@ var parseNodeTests = []struct { input string wantError string wantResult *Node - retries uint }{ // Records { @@ -74,7 +73,6 @@ var parseNodeTests = []struct { { input: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@invalid.:3", wantError: `no such host`, - retries: 2, }, { input: "enode://1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439@127.0.0.1:foo", @@ -185,7 +183,6 @@ func TestParseNode(t *testing.T) { } if !reflect.DeepEqual(n, test.wantResult) { t.Errorf("test %q:\n result mismatch:\ngot: %#v\nwant: %#v", test.input, n, test.wantResult) - continue } } }