diff options
author | Ferenc Szabo <frncmx@gmail.com> | 2019-02-21 05:57:42 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2019-02-21 05:57:42 +0800 |
commit | e38b227ce6400567f0f4e4ff9e1cce7f93a175ed (patch) | |
tree | ed148dc1df2a1f2a70f474f424ff2d656facf993 /swarm/storage | |
parent | d36e974ba303d12d79d769d0811dd5babcf6688f (diff) | |
download | go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar.gz go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar.bz2 go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar.lz go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar.xz go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.tar.zst go-tangerine-e38b227ce6400567f0f4e4ff9e1cce7f93a175ed.zip |
Ci race detector handle failing tests (#19143)
* swarm/storage: increase mget timeout in common_test.go
TestDbStoreCorrect_1k sometimes timed out with -race on Travis.
--- FAIL: TestDbStoreCorrect_1k (24.63s)
common_test.go:194: testStore failed: timed out after 10s
* swarm: remove unused vars from TestSnapshotSyncWithServer
nodeCount and chunkCount is returned from setupSim and those values
we use.
* swarm: move race/norace helpers from stream to testutil
As we will need to use the flag in other packages, too.
* swarm: refactor TestSwarmNetwork case
Extract long running test cases for better visibility.
* swarm/network: skip TestSyncingViaGlobalSync with -race
As panics on Travis.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7e351b]
* swarm: run TestSwarmNetwork with fewer nodes with -race
As otherwise we always get test failure with `network_test.go:374:
context deadline exceeded` even with raised `Timeout`.
* swarm/network: run TestDeliveryFromNodes with fewer nodes with -race
Test on Travis times out with 8 or more nodes if -race flag is present.
* swarm/network: smaller node count for discovery tests with -race
TestDiscoveryPersistenceSimulationSimAdapters failed on Travis with
`-race` flag present. The failure was due to extensive memory usage,
coming from the CGO runtime. Using a smaller node count resolves the
issue.
=== RUN TestDiscoveryPersistenceSimulationSimAdapter
==7227==ERROR: ThreadSanitizer failed to allocate 0x80000 (524288) bytes of clock allocator (error code: 12)
FATAL: ThreadSanitizer CHECK failed: ./gotsan.cc:6976 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
FAIL github.com/ethereum/go-ethereum/swarm/network/simulations/discovery 804.826s
* swarm/network: run TestFileRetrieval with fewer nodes with -race
Otherwise we get a failure due to extensive memory usage, as the CGO
runtime cannot allocate more bytes.
=== RUN TestFileRetrieval
==7366==ERROR: ThreadSanitizer failed to allocate 0x80000 (524288) bytes of clock allocator (error code: 12)
FATAL: ThreadSanitizer CHECK failed: ./gotsan.cc:6976 "((0 && "unable to mmap")) != (0)" (0x0, 0x0)
FAIL github.com/ethereum/go-ethereum/swarm/network/stream 155.165s
* swarm/network: run TestRetrieval with fewer nodes with -race
Otherwise we get a failure due to extensive memory usage, as the CGO
runtime cannot allocate more bytes ("ThreadSanitizer failed to
allocate").
* swarm/network: skip flaky TestGetSubscriptionsRPC on Travis w/ -race
Test fails a lot with something like:
streamer_test.go:1332: Real subscriptions and expected amount don't match; real: 0, expected: 20
* swarm/storage: skip TestDB_SubscribePull* tests on Travis w/ -race
Travis just hangs...
ok github.com/ethereum/go-ethereum/swarm/storage/feed/lookup 1.307s
keepalive
keepalive
keepalive
or panics after a while.
Without these tests the race detector job is now stable. Let's
invetigate these tests in a separate issue:
https://github.com/ethersphere/go-ethereum/issues/1245
Diffstat (limited to 'swarm/storage')
-rw-r--r-- | swarm/storage/common_test.go | 2 | ||||
-rw-r--r-- | swarm/storage/localstore/gc_test.go | 2 | ||||
-rw-r--r-- | swarm/storage/localstore/subscription_pull_test.go | 32 |
3 files changed, 35 insertions, 1 deletions
diff --git a/swarm/storage/common_test.go b/swarm/storage/common_test.go index 6955ee827..e74d0f4b8 100644 --- a/swarm/storage/common_test.go +++ b/swarm/storage/common_test.go @@ -142,7 +142,7 @@ func mget(store ChunkStore, hs []Address, f func(h Address, chunk Chunk) error) close(errc) }() var err error - timeout := 10 * time.Second + timeout := 20 * time.Second select { case err = <-errc: case <-time.NewTimer(timeout).C: diff --git a/swarm/storage/localstore/gc_test.go b/swarm/storage/localstore/gc_test.go index eb039a554..322b84665 100644 --- a/swarm/storage/localstore/gc_test.go +++ b/swarm/storage/localstore/gc_test.go @@ -47,6 +47,8 @@ func TestDB_collectGarbageWorker_multipleBatches(t *testing.T) { // testDB_collectGarbageWorker is a helper test function to test // garbage collection runs by uploading and syncing a number of chunks. func testDB_collectGarbageWorker(t *testing.T) { + t.Helper() + chunkCount := 150 testHookCollectGarbageChan := make(chan int64) diff --git a/swarm/storage/localstore/subscription_pull_test.go b/swarm/storage/localstore/subscription_pull_test.go index 5c99e0dec..16fe8b0dd 100644 --- a/swarm/storage/localstore/subscription_pull_test.go +++ b/swarm/storage/localstore/subscription_pull_test.go @@ -20,11 +20,13 @@ import ( "bytes" "context" "fmt" + "os" "sync" "testing" "time" "github.com/ethereum/go-ethereum/swarm/storage" + "github.com/ethereum/go-ethereum/swarm/testutil" ) // TestDB_SubscribePull uploads some chunks before and after @@ -32,6 +34,12 @@ import ( // all addresses are received in the right order // for expected proximity order bins. func TestDB_SubscribePull(t *testing.T) { + + if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" { + t.Skip("does not complete with -race on Travis") + // Note: related ticket TODO + } + db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() @@ -79,6 +87,12 @@ func TestDB_SubscribePull(t *testing.T) { // validates if all addresses are received in the right order // for expected proximity order bins. func TestDB_SubscribePull_multiple(t *testing.T) { + + if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" { + t.Skip("does not complete with -race on Travis") + // Note: related ticket TODO + } + db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() @@ -132,6 +146,12 @@ func TestDB_SubscribePull_multiple(t *testing.T) { // and validates if all expected addresses are received in the // right order for expected proximity order bins. func TestDB_SubscribePull_since(t *testing.T) { + + if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" { + t.Skip("does not complete with -race on Travis") + // Note: related ticket TODO + } + db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() @@ -222,6 +242,12 @@ func TestDB_SubscribePull_since(t *testing.T) { // and validates if all expected addresses are received in the // right order for expected proximity order bins. func TestDB_SubscribePull_until(t *testing.T) { + + if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" { + t.Skip("does not complete with -race on Travis") + // Note: related ticket TODO + } + db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() @@ -311,6 +337,12 @@ func TestDB_SubscribePull_until(t *testing.T) { // and until arguments, and validates if all expected addresses // are received in the right order for expected proximity order bins. func TestDB_SubscribePull_sinceAndUntil(t *testing.T) { + + if testutil.RaceEnabled && os.Getenv("TRAVIS") == "true" { + t.Skip("does not complete with -race on Travis") + // Note: related ticket TODO + } + db, cleanupFunc := newTestDB(t, nil) defer cleanupFunc() |