problem: too slow to validate WS on CI

This commit is contained in:
Igor Artamonov
2021-09-21 22:06:44 -04:00
parent 5586a95063
commit 1f864bdbe3
3 changed files with 11 additions and 5 deletions

View File

@@ -32,6 +32,8 @@ jobs:
uses: eskatos/gradle-command-action@v1
with:
arguments: check
env:
CI: true
- name: Upload Coverage Report
uses: codecov/codecov-action@v1
@@ -64,6 +66,7 @@ jobs:
with:
arguments: check
env:
CI: true
DSHACKLE_TEST_ENABLED: redis
REDIS_HOST: redis
REDIS_PORT: 6379

View File

@@ -33,7 +33,7 @@ class MockWSServer extends WebSocketServer {
void reply(String message) {
log(">> $message")
if (conn == null) {
println("MOCKWS: ERROR, no active connection")
log("MOCKWS: ERROR, no active connection")
}
conn.send(message)
}

View File

@@ -10,8 +10,6 @@ import java.time.Duration
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 int port = 19900 + new Random().nextInt(100)
@@ -21,6 +19,11 @@ class EthereumWsFactoryRealSpec extends Specification {
EthereumWsFactory.EthereumWs conn
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++
server = new MockWSServer(port)
server.start()
@@ -52,7 +55,7 @@ class EthereumWsFactoryRealSpec extends Specification {
then:
StepVerifier.create(resp)
.then {
server.reply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
server.onNextReply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
}
.expectNextMatches {
it.hasResult() && it.resultAsProcessedString == "baz"
@@ -121,7 +124,7 @@ class EthereumWsFactoryRealSpec extends Specification {
then:
StepVerifier.create(resp)
.then {
server.reply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
server.onNextReply('{"jsonrpc":"2.0", "id":100, "result": "baz"}')
}
.expectNextMatches {
it.hasResult() && it.resultAsProcessedString == "baz"