solution: WS-only Ethereum upstream

This commit is contained in:
Igor Artamonov
2021-09-20 22:04:25 -04:00
parent 568a045271
commit b68da0f801
8 changed files with 217 additions and 34 deletions

View File

@@ -74,6 +74,32 @@ class UpstreamsConfigReaderSpec extends Specification {
}
}
def "Parse websocket-only config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-ws-only.yaml")
when:
def act = reader.read(config)
then:
act != null
act.upstreams.size() == 1
with(act.upstreams.get(0)) {
id == "local"
chain == "ethereum"
connection instanceof UpstreamsConfig.EthereumConnection
with((UpstreamsConfig.EthereumConnection) connection) {
rpc == null
ws != null
ws.url == new URI("ws://localhost:8546")
ws.basicAuth != null
with(ws.basicAuth) {
username == "9c199ad8f281f20154fc258fe41a6814"
password == "258fe4149c199ad8f2811a68f20154fc"
}
}
}
}
def "Parse bitcoin upstreams"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-bitcoin.yaml")

View File

@@ -0,0 +1,13 @@
version: v1
upstreams:
- id: local
chain: ethereum
connection:
ethereum:
ws:
url: "ws://localhost:8546"
origin: "http://localhost"
basic-auth:
username: 9c199ad8f281f20154fc258fe41a6814
password: 258fe4149c199ad8f2811a68f20154fc