From 8d49856ffda19a81fd9d2451ca6413ca6b46a817 Mon Sep 17 00:00:00 2001 From: Igor Artamonov Date: Sat, 16 May 2020 17:17:21 -0400 Subject: [PATCH] problem: sporadic unit-test failure --- .../emeraldpay/dshackle/rpc/TrackEthereumAddressSpec.groovy | 2 +- .../io/emeraldpay/dshackle/test/EthereumHeadMock.groovy | 1 + .../io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy | 1 + .../groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy | 4 +++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/groovy/io/emeraldpay/dshackle/rpc/TrackEthereumAddressSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/rpc/TrackEthereumAddressSpec.groovy index 71f74b96..5e68d010 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/rpc/TrackEthereumAddressSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/rpc/TrackEthereumAddressSpec.groovy @@ -113,6 +113,6 @@ class TrackEthereumAddressSpec extends Specification { } .expectNext(exp2).as("Second block") .thenCancel() - .verify(Duration.ofSeconds(1)) + .verify(Duration.ofSeconds(2)) } } diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy index 46810e8d..133f63df 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumHeadMock.groovy @@ -31,6 +31,7 @@ class EthereumHeadMock implements Head { void nextBlock(BlockContainer block) { assert block != null + println("New block: ${block.height} / ${block.hash}") latest = block bus.onNext(block) } diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy index f9ccff6f..9bfdbef0 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/EthereumUpstreamMock.groovy @@ -65,6 +65,7 @@ class EthereumUpstreamMock extends EthereumUpstream { methods, TestingCommons.objectMapper()) setLag(0) setStatus(UpstreamAvailability.OK) + start() } void nextBlock(BlockContainer block) { diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy index e46b3e9f..df2fb400 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/TestingCommons.groovy @@ -76,7 +76,9 @@ class TestingCommons { } static Multistream aggregatedUpstream(EthereumUpstream up) { - return new EthereumMultistream(Chain.ETHEREUM, [up], Caches.default(objectMapper()), objectMapper()) + return new EthereumMultistream(Chain.ETHEREUM, [up], Caches.default(objectMapper()), objectMapper()).tap { + start() + } } static CachesFactory emptyCaches() {