problem: unable to run without default options

This commit is contained in:
Igor Artamonov
2019-08-21 17:39:20 -04:00
parent 8a99212fc5
commit 6716abfb4d
3 changed files with 34 additions and 1 deletions

View File

@@ -136,4 +136,27 @@ class UpstreamsConfigReaderSpec extends Specification {
"\${PASSWORD}" | "1a68f20154fc258fe4149c199ad8f281"
}
def "Parse config without defaults"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-no-defaults.yaml")
when:
def act = reader.read(config)
then:
act != null
act.version == "v1"
with(act.defaultOptions) {
size() == 0
}
act.upstreams.size() == 1
with(act.upstreams.get(0)) {
id == "local"
chain == "ethereum"
connection instanceof UpstreamsConfig.EthereumConnection
with((UpstreamsConfig.EthereumConnection)connection) {
rpc != null
rpc.url == new URI("http://localhost:8545")
ws == null
}
}
}
}

View File

@@ -0,0 +1,9 @@
version: v1
upstreams:
- id: local
chain: ethereum
connection:
ethereum:
rpc:
url: "http://localhost:8545"