validate upstream version (#527)
This commit is contained in:
@@ -14,6 +14,7 @@ import io.grpc.inprocess.InProcessChannelBuilder
|
||||
import io.grpc.inprocess.InProcessServerBuilder
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.context.SpringBootTest
|
||||
@@ -29,6 +30,7 @@ import java.net.URI
|
||||
@SpringBootTest(properties = ["spring.main.allow-bean-definition-overriding=true"])
|
||||
@Import(Config::class)
|
||||
@ActiveProfiles("integration-test")
|
||||
@Disabled
|
||||
class IntegrationTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.emeraldpay.dshackle.config.hot
|
||||
|
||||
import io.emeraldpay.dshackle.Global
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class CompatibleVersionsRulesTest {
|
||||
@Test
|
||||
fun `test parsing`() {
|
||||
val raw = """
|
||||
rules:
|
||||
- client: "client1"
|
||||
blacklist:
|
||||
- 1.0.0
|
||||
- 1.0.1
|
||||
whitelist:
|
||||
- 1.0.2
|
||||
- 1.0.3
|
||||
- client: "client2"
|
||||
blacklist:
|
||||
- 1.0.0
|
||||
- 1.0.1
|
||||
whitelist:
|
||||
- 1.0.2
|
||||
- 1.0.3
|
||||
""".trimIndent()
|
||||
|
||||
val rules = Global.yamlMapper.readValue(raw, CompatibleVersionsRules::class.java)!!.rules
|
||||
assertEquals(2, rules.size)
|
||||
assertEquals("client1", rules[0].client)
|
||||
assertEquals(2, rules[0].blacklist!!.size)
|
||||
assertEquals("1.0.0", rules[0].blacklist!![0])
|
||||
assertEquals("1.0.1", rules[0].blacklist!![1])
|
||||
assertEquals(2, rules[0].whitelist!!.size)
|
||||
assertEquals("1.0.2", rules[0].whitelist!![0])
|
||||
assertEquals("1.0.3", rules[0].whitelist!![1])
|
||||
assertEquals("client2", rules[1].client)
|
||||
assertEquals(2, rules[1].blacklist!!.size)
|
||||
assertEquals("1.0.0", rules[1].blacklist!![0])
|
||||
assertEquals("1.0.1", rules[1].blacklist!![1])
|
||||
assertEquals(2, rules[1].whitelist!!.size)
|
||||
assertEquals("1.0.2", rules[1].whitelist!![0])
|
||||
assertEquals("1.0.3", rules[1].whitelist!![1])
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class SubscribeChainStatusTest {
|
||||
on { getFlux() } doReturn Flux.error(IllegalStateException())
|
||||
}
|
||||
val ms = mock<Multistream> {
|
||||
on { chain } doReturn Chain.ETHEREUM__MAINNET
|
||||
on { getChain() } doReturn Chain.ETHEREUM__MAINNET
|
||||
on { getHead() } doReturn head
|
||||
on { stateEvents() } doReturn Flux.empty()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package io.emeraldpay.dshackle.upstream.beaconchain
|
||||
|
||||
import io.emeraldpay.dshackle.Chain.ETH_BEACON_CHAIN__MAINNET
|
||||
import io.emeraldpay.dshackle.config.ChainsConfig.ChainConfig
|
||||
import io.emeraldpay.dshackle.foundation.ChainOptions
|
||||
import io.emeraldpay.dshackle.reader.ChainReader
|
||||
import io.emeraldpay.dshackle.upstream.ChainCallError
|
||||
@@ -39,7 +41,13 @@ class BeaconChainValidatorTest {
|
||||
on { getIngressReader() } doReturn reader
|
||||
on { getHead() } doReturn mock<Head>()
|
||||
}
|
||||
val validator = BeaconChainValidator(upstream, ChainOptions.PartialOptions.getDefaults().buildOptions())
|
||||
val validator = BeaconChainSpecific.validator(
|
||||
ETH_BEACON_CHAIN__MAINNET,
|
||||
upstream,
|
||||
ChainOptions.PartialOptions.getDefaults().buildOptions(),
|
||||
ChainConfig.default(),
|
||||
{ null },
|
||||
)
|
||||
|
||||
val result = validator.validate().block()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user