solution: integration test with Rinkeby
This commit is contained in:
@@ -63,7 +63,7 @@ export DSHACKLE_TEST_ETH1_WS=ws://127.0.0.1:8546
|
||||
export DSHACKLE_TEST_ETH1_WSORIGIN=http://127.0.0.1:8546
|
||||
----
|
||||
|
||||
Finally, run the dDshackle instance:
|
||||
Finally, run the Dshackle instance:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
@@ -77,4 +77,28 @@ Finally, run the dDshackle instance:
|
||||
./testing/trial/gradlew -p testing/trial -PdshackleTrialMode=real cleanTest test
|
||||
----
|
||||
|
||||
== Real (Rinkeby) Test
|
||||
|
||||
Runs requests against a Rinkeby Testnet.
|
||||
Configuration is similar to the Mainnet config, but instead of `ETH1` is has `RINKEBY`.
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
export DSHACKLE_TEST_RINKEBY_RPC=
|
||||
export DSHACKLE_TEST_RINKEBY_WS=
|
||||
export DSHACKLE_TEST_RINKEBY_WSORIGIN=
|
||||
----
|
||||
|
||||
And run the Dshackle instance:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
./gradlew run --args="--configPath=./testing/dshackle/dshackle-rinkeby.yaml"
|
||||
----
|
||||
|
||||
=== Run tests
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
./testing/trial/gradlew -p testing/trial -PdshackleTrialMode=rinkeby cleanTest test
|
||||
----
|
||||
|
||||
26
testing/dshackle/dshackle-rinkeby.yaml
Normal file
26
testing/dshackle/dshackle-rinkeby.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: v1
|
||||
port: 12448
|
||||
|
||||
tls:
|
||||
enabled: false
|
||||
|
||||
cluster:
|
||||
upstreams:
|
||||
- id: rinkeby-1
|
||||
chain: rinkeby
|
||||
connection:
|
||||
ethereum:
|
||||
rpc:
|
||||
url: "${DSHACKLE_TEST_RINKEBY_RPC}"
|
||||
|
||||
cache:
|
||||
redis:
|
||||
enabled: false
|
||||
|
||||
proxy:
|
||||
port: 18081
|
||||
tls:
|
||||
enabled: false
|
||||
routes:
|
||||
- id: rinkeby
|
||||
blockchain: rinkeby
|
||||
@@ -32,6 +32,10 @@ class ProxyClient {
|
||||
return forPrefix(18081, "eth")
|
||||
}
|
||||
|
||||
static ProxyClient ethereumRinkeby() {
|
||||
return forPrefix(18081, "rinkeby")
|
||||
}
|
||||
|
||||
static ProxyClient forPrefix(String prefix) {
|
||||
return forPrefix(18080, prefix)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.emeraldpay.dshackle.testing.trial.rinkeby
|
||||
|
||||
import io.emeraldpay.dshackle.testing.trial.ProxyClient
|
||||
import spock.lang.IgnoreIf
|
||||
import spock.lang.Specification
|
||||
|
||||
@IgnoreIf({ System.getProperty('trialMode') != 'rinkeby' })
|
||||
class CallContractSpec extends Specification {
|
||||
|
||||
def client = ProxyClient.ethereumRinkeby()
|
||||
|
||||
def "get block"() {
|
||||
when:
|
||||
def act = client.execute(65, "eth_call",
|
||||
[
|
||||
[
|
||||
"to" : "0xB8Ba177465b3d696180742c6ba58C408175CB6Dd",
|
||||
"data": "0x70a08231000000000000000000000000da3f87aa38d07f1fc836873a3b34ec23088ef78a"
|
||||
],
|
||||
"0xc90f1c8c125a4d5b90742f16947bdb1d10516f173fd7fc51223d10499de2a812"
|
||||
]
|
||||
)
|
||||
then:
|
||||
act.id == 65
|
||||
act.result != null
|
||||
act.result == "0x000000000000000000000000000000000000000000000000000000003af9a800"
|
||||
act.error == null
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user