solution: reorganize test data

(cherry picked from commit 7af620984a)
This commit is contained in:
a10zn8
2022-09-24 00:01:00 +04:00
parent d4100d8f58
commit 1d9820ee9e
35 changed files with 58 additions and 31 deletions

View File

@@ -23,7 +23,7 @@ class CacheConfigReaderSpec extends Specification {
def "Read full"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("cache-redis-full.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/cache-redis-full.yaml")
when:
def act = reader.read(config)
@@ -39,7 +39,7 @@ class CacheConfigReaderSpec extends Specification {
def "Read disabled"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("cache-redis-disabled.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/cache-redis-disabled.yaml")
when:
def act = reader.read(config)

View File

@@ -24,7 +24,7 @@ class HealthConfigReaderSpec extends Specification {
def "Read empty"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-health-empty.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-health-empty.yaml")
when:
def act = reader.read(config)
@@ -38,7 +38,7 @@ class HealthConfigReaderSpec extends Specification {
def "Read single"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-health-1.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-health-1.yaml")
when:
def act = reader.read(config)
@@ -58,7 +58,7 @@ class HealthConfigReaderSpec extends Specification {
def "Read multiple"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-health-2.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-health-2.yaml")
when:
def act = reader.read(config)

View File

@@ -22,11 +22,12 @@ import spock.lang.Specification
class MainConfigReaderSpec extends Specification {
MainConfigReader reader = new MainConfigReader(TestingCommons.fileResolver())
def "Read full config"() {
def "Read full config with inclusion"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-full.yaml")
// the File Resolver should be able to resolve/include files
MainConfigReader reader = new MainConfigReader(TestingCommons.fileResolver())
// note that it references another config to be included
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-full.yaml")
when:
def act = reader.read(config)

View File

@@ -23,7 +23,7 @@ class MonitoringConfigReaderSpec extends Specification {
def "Read basic monitoring config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-monitoring-basic.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-monitoring-basic.yaml")
when:
def act = reader.read(config)

View File

@@ -24,7 +24,7 @@ class ProxyConfigReaderSpec extends Specification {
def "Read basic proxy config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-basic.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-proxy-basic.yaml")
when:
def act = reader.read(config)
@@ -42,7 +42,7 @@ class ProxyConfigReaderSpec extends Specification {
def "Read proxy config with websocket disabled"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-no-ws.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-proxy-no-ws.yaml")
when:
def act = reader.read(config)
@@ -53,7 +53,7 @@ class ProxyConfigReaderSpec extends Specification {
def "Read proxy config with two elements"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-two.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-proxy-two.yaml")
when:
def act = reader.read(config)
@@ -73,7 +73,7 @@ class ProxyConfigReaderSpec extends Specification {
def "Read max proxy config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("dshackle-proxy-max.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/dshackle-proxy-max.yaml")
when:
def act = reader.read(config)

View File

@@ -25,7 +25,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse standard config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-basic.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-basic.yaml")
when:
def act = reader.read(config)
then:
@@ -73,7 +73,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse websocket-only config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-ws-only.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-ws-only.yaml")
when:
def act = reader.read(config)
then:
@@ -98,7 +98,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse full defined websocket config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-ws-full.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-ws-full.yaml")
when:
def act = reader.read(config)
then:
@@ -125,7 +125,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse bitcoin upstreams"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-bitcoin.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-bitcoin.yaml")
when:
def act = reader.read(config)
then:
@@ -173,7 +173,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse bitcoin upstreams with esplora"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-bitcoin-esplora.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-bitcoin-esplora.yaml")
when:
def act = reader.read(config)
then:
@@ -202,7 +202,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse ds config"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-ds.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-ds.yaml")
when:
def act = reader.read(config)
then:
@@ -225,7 +225,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with labels"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-labels.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-labels.yaml")
when:
def act = reader.read(config)
then:
@@ -246,7 +246,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with options"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-options.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-options.yaml")
when:
def act = reader.read(config)
then:
@@ -262,7 +262,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config without defaults"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-no-defaults.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-no-defaults.yaml")
when:
def act = reader.read(config)
then:
@@ -285,7 +285,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with methods"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-methods.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-methods.yaml")
when:
def act = reader.read(config)
then:
@@ -305,7 +305,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with methods and quorum"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-methods-quorum.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-methods-quorum.yaml")
when:
def act = reader.read(config)
then:
@@ -328,7 +328,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with invalid ids"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-no-id.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-no-id.yaml")
when:
def act = reader.read(config)
then:
@@ -355,7 +355,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config without fallback role"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-basic.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-basic.yaml")
when:
def act = reader.read(config)
then:
@@ -367,7 +367,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with fallback role"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-roles.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-roles.yaml")
when:
def act = reader.read(config)
then:
@@ -379,7 +379,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with secondary role"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-roles-2.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-roles-2.yaml")
when:
def act = reader.read(config)
then:
@@ -392,7 +392,7 @@ class UpstreamsConfigReaderSpec extends Specification {
def "Parse config with invalid role"() {
setup:
def config = this.class.getClassLoader().getResourceAsStream("upstreams-roles-invalid.yaml")
def config = this.class.getClassLoader().getResourceAsStream("configs/upstreams-roles-invalid.yaml")
when:
def act = reader.read(config)
then:

View File

@@ -113,7 +113,7 @@ class TestingCommons {
}
static FileResolver fileResolver() {
return new FileResolver(new File("src/test/resources"))
return new FileResolver(new File("src/test/resources/configs"))
}
static BlockContainer blockForEthereum(Long height) {

View File

@@ -0,0 +1,26 @@
version: v1
upstreams:
- id: local
chain: ethereum
priority: 100
connection:
ethereum:
rpc:
url: "http://localhost:8545"
- id: infura
chain: ethereum
role: fallback
priority: 50
connection:
ethereum:
rpc:
url: "https://mainnet.infura.io/v3/fa28c968191849c1aff541ad1d8511f2"
- id: remote
priority: 75
connection:
grpc:
host: "10.2.0.15"