solution: upgrade Reactor libs

This commit is contained in:
Igor Artamonov
2021-09-15 23:21:07 -04:00
parent 1576f1fe64
commit 817f794c04
16 changed files with 71 additions and 44 deletions

View File

@@ -24,6 +24,7 @@ import spock.lang.Specification
import java.time.Duration
import java.time.Instant
import java.util.concurrent.Executors
class AbstractHeadSpec extends Specification {
@@ -44,9 +45,9 @@ class AbstractHeadSpec extends Specification {
called = true
}
def act = head.flux
source.tryEmitNext(blocks[0])
then:
StepVerifier.create(act)
.then { source.tryEmitNext(blocks[0]) }
.expectNext(blocks[0])
.then {
assert called
@@ -69,9 +70,9 @@ class AbstractHeadSpec extends Specification {
when:
head.follow(source.asFlux())
def act = head.flux
source.tryEmitNext(blocks[0])
then:
StepVerifier.create(act)
.then { source.tryEmitNext(blocks[0]) }
.expectNext(blocks[0])
.then { source.tryEmitNext(blocks[1]) }
.expectNext(blocks[1])
@@ -97,9 +98,9 @@ class AbstractHeadSpec extends Specification {
when:
head.follow(source.asFlux())
def act = head.flux
source.tryEmitNext(blocks[0])
then:
StepVerifier.create(act)
.then { source.tryEmitNext(blocks[0]) }
.expectNext(blocks[0])
.then { source.tryEmitNext(blocks[1]) }
.expectNext(blocks[1])

View File

@@ -52,12 +52,10 @@ class EthereumWsFactorySpec extends Specification {
when:
def act = Flux.from(ws.getFlux())
new Thread({
ws.onNewBlock(block)
}).run()
then:
StepVerifier.create(act)
.then { ws.onNewBlock(block) }
.expectNext(BlockContainer.from(block))
.thenCancel()
.verify(Duration.ofSeconds(1))

View File

@@ -87,7 +87,7 @@ class EthereumGrpcUpstreamSpec extends Specification {
.addAllSupportedMethods(["eth_getBlockByHash"])
.build())
when:
upstream.start()
new Thread({ Thread.sleep(50); upstream.start() }).start()
def h = upstream.head.getFlux().next().block(Duration.ofSeconds(1))
then:
callData.chain == Chain.ETHEREUM.id
@@ -145,7 +145,7 @@ class EthereumGrpcUpstreamSpec extends Specification {
.addAllSupportedMethods(["eth_getBlockByHash"])
.build())
when:
upstream.start()
new Thread({ Thread.sleep(50); upstream.start() }).start()
def h = upstream.head.getFlux().take(Duration.ofSeconds(1)).last().block()
then:
upstream.status == UpstreamAvailability.OK
@@ -207,7 +207,7 @@ class EthereumGrpcUpstreamSpec extends Specification {
.addAllSupportedMethods(["eth_getBlockByHash"])
.build())
when:
upstream.start()
new Thread({ Thread.sleep(50); upstream.start() }).start()
finished.get()
def h = upstream.head.getFlux().take(Duration.ofSeconds(1)).last().block()
then:

View File

@@ -66,13 +66,13 @@ class GrpcHeadSpec extends Specification {
when:
def act = head.getFlux()
.take(3)
head.start(client)
then:
StepVerifier.create(act)
.expectNext(TestingCommons.blockForBitcoin(10))
.expectNext(TestingCommons.blockForBitcoin(11))
.expectNext(TestingCommons.blockForBitcoin(12))
.then { head.start(client) }
.expectNext(TestingCommons.blockForBitcoin(10)).as("block 10")
.expectNext(TestingCommons.blockForBitcoin(11)).as("block 11")
.expectNext(TestingCommons.blockForBitcoin(12)).as("block 12")
.expectComplete()
.verify(Duration.ofSeconds(5))
}