problem: too slow to validate WS on CI
This commit is contained in:
3
.github/workflows/test.yaml
vendored
3
.github/workflows/test.yaml
vendored
@@ -32,6 +32,8 @@ jobs:
|
|||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
with:
|
with:
|
||||||
arguments: check
|
arguments: check
|
||||||
|
env:
|
||||||
|
CI: true
|
||||||
|
|
||||||
- name: Upload Coverage Report
|
- name: Upload Coverage Report
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
@@ -64,6 +66,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
arguments: check
|
arguments: check
|
||||||
env:
|
env:
|
||||||
|
CI: true
|
||||||
DSHACKLE_TEST_ENABLED: redis
|
DSHACKLE_TEST_ENABLED: redis
|
||||||
REDIS_HOST: redis
|
REDIS_HOST: redis
|
||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
@@ -33,7 +33,7 @@ class MockWSServer extends WebSocketServer {
|
|||||||
void reply(String message) {
|
void reply(String message) {
|
||||||
log(">> $message")
|
log(">> $message")
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
println("MOCKWS: ERROR, no active connection")
|
log("MOCKWS: ERROR, no active connection")
|
||||||
}
|
}
|
||||||
conn.send(message)
|
conn.send(message)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import java.time.Duration
|
|||||||
|
|
||||||
class EthereumWsFactoryRealSpec extends Specification {
|
class EthereumWsFactoryRealSpec extends Specification {
|
||||||
|
|
||||||
// needs large timeouts and sleep, especially on CI where it's much slower to run
|
|
||||||
static TIMEOUT = 15
|
|
||||||
static SLEEP = 500
|
static SLEEP = 500
|
||||||
|
|
||||||
static int port = 19900 + new Random().nextInt(100)
|
static int port = 19900 + new Random().nextInt(100)
|
||||||
@@ -21,6 +19,11 @@ class EthereumWsFactoryRealSpec extends Specification {
|
|||||||
EthereumWsFactory.EthereumWs conn
|
EthereumWsFactory.EthereumWs conn
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
if (System.getenv("CI") == "true") {
|
||||||
|
println("RUN IN CI ENVIRONMENT")
|
||||||
|
// needs large timeouts on CI where it's much slower to run
|
||||||
|
SLEEP = 1500
|
||||||
|
}
|
||||||
port++
|
port++
|
||||||
server = new MockWSServer(port)
|
server = new MockWSServer(port)
|
||||||
server.start()
|
server.start()
|
||||||
@@ -52,7 +55,7 @@ class EthereumWsFactoryRealSpec extends Specification {
|
|||||||
then:
|
then:
|
||||||
StepVerifier.create(resp)
|
StepVerifier.create(resp)
|
||||||
.then {
|
.then {
|
||||||
server.reply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
|
server.onNextReply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
|
||||||
}
|
}
|
||||||
.expectNextMatches {
|
.expectNextMatches {
|
||||||
it.hasResult() && it.resultAsProcessedString == "baz"
|
it.hasResult() && it.resultAsProcessedString == "baz"
|
||||||
@@ -121,7 +124,7 @@ class EthereumWsFactoryRealSpec extends Specification {
|
|||||||
then:
|
then:
|
||||||
StepVerifier.create(resp)
|
StepVerifier.create(resp)
|
||||||
.then {
|
.then {
|
||||||
server.reply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
|
server.onNextReply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
|
||||||
}
|
}
|
||||||
.expectNextMatches {
|
.expectNextMatches {
|
||||||
it.hasResult() && it.resultAsProcessedString == "baz"
|
it.hasResult() && it.resultAsProcessedString == "baz"
|
||||||
|
|||||||
Reference in New Issue
Block a user