problem: unnecessary method for Head
This commit is contained in:
@@ -18,13 +18,8 @@ class EthereumHeadMock implements EthereumHead {
|
||||
bus.onNext(block)
|
||||
}
|
||||
|
||||
@Override
|
||||
Mono<BlockJson<TransactionId>> getHead() {
|
||||
return latest != null ? Mono.just(latest) : Mono.from(bus)
|
||||
}
|
||||
|
||||
@Override
|
||||
Flux<BlockJson<TransactionId>> getFlux() {
|
||||
return Flux.concat(getHead(), bus).distinctUntilChanged()
|
||||
return Flux.concat(Mono.justOrEmpty(latest), bus).distinctUntilChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class GrpcUpstreamSpec extends Specification {
|
||||
upstream.setLag(0)
|
||||
when:
|
||||
upstream.start()
|
||||
def h = upstream.head.head.block(Duration.ofSeconds(1))
|
||||
def h = upstream.head.getFlux().next().block(Duration.ofSeconds(1))
|
||||
then:
|
||||
callData.chain == Chain.ETHEREUM.id
|
||||
upstream.status == UpstreamAvailability.OK
|
||||
@@ -114,7 +114,7 @@ class GrpcUpstreamSpec extends Specification {
|
||||
when:
|
||||
upstream.start()
|
||||
finished.get()
|
||||
def h = upstream.head.head.block(Duration.ofSeconds(1))
|
||||
def h = upstream.head.getFlux().next().block(Duration.ofSeconds(1))
|
||||
then:
|
||||
upstream.status == UpstreamAvailability.OK
|
||||
h.hash == BlockHash.from("0x50d26e119968e791970d84a7bf5d0ec474d3ec2ef85d5ec8915210ac6bc09ad7")
|
||||
@@ -171,7 +171,7 @@ class GrpcUpstreamSpec extends Specification {
|
||||
when:
|
||||
upstream.start()
|
||||
finished.get()
|
||||
def h = upstream.head.head.block(Duration.ofSeconds(1))
|
||||
def h = upstream.head.getFlux().next().block(Duration.ofSeconds(1))
|
||||
then:
|
||||
upstream.status == UpstreamAvailability.OK
|
||||
h.hash == BlockHash.from("0x3ec2ebf5d0ec474d0ac6bc50d2770d8409ad76e119968e7919f85d5ec891521a")
|
||||
|
||||
@@ -37,12 +37,14 @@ class HeadLagObserverSpec extends Specification {
|
||||
def masterBus = TopicProcessor.create()
|
||||
|
||||
1 * master.getFlux() >> Flux.from(masterBus)
|
||||
1 * head1.getHead() >> Mono.just(blocks[1])
|
||||
1 * head1.getFlux() >> Flux.just(blocks[2])
|
||||
.delaySubscription(Duration.ofSeconds(1))
|
||||
1 * head2.getHead() >> Mono.just(blocks[0])
|
||||
1 * head2.getFlux() >> Flux.just(blocks[1])
|
||||
.delaySubscription(Duration.ofMillis(100))
|
||||
1 * head1.getFlux() >> Flux.merge(
|
||||
Flux.just(blocks[1]),
|
||||
Flux.just(blocks[2]).delaySubscription(Duration.ofSeconds(1))
|
||||
)
|
||||
1 * head2.getFlux() >> Flux.merge(
|
||||
Flux.just(blocks[0]),
|
||||
Flux.just(blocks[1]).delaySubscription(Duration.ofMillis(100))
|
||||
)
|
||||
1 * up1.setLag(0)
|
||||
1 * up2.setLag(1)
|
||||
1 * up2.setLag(0)
|
||||
|
||||
Reference in New Issue
Block a user