From 486eb97e87fa436bdcb82ef8660b3349651aac93 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Tue, 5 Nov 2019 11:57:06 +0100 Subject: [PATCH] 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 1f0c8f8f94..c992451c4f 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 04ed251762..ac5c72b6b1 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 260a173dde..fdfd81320f 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 6c950872d1..05ddca3efd 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 a8d24966e6..0000000000 --- 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 68aabb9363..34f17e8a24 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 2e3f9ba00e..3af2ec5e44 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) }