diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8ba13463..f19f1627 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 \ No newline at end of file diff --git a/src/test/groovy/io/emeraldpay/dshackle/test/MockWSServer.groovy b/src/test/groovy/io/emeraldpay/dshackle/test/MockWSServer.groovy index 5a6ad76a..65f6ba4d 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/test/MockWSServer.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/test/MockWSServer.groovy @@ -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) } diff --git a/src/test/groovy/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsFactoryRealSpec.groovy b/src/test/groovy/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsFactoryRealSpec.groovy index a884b1de..8edfc3b2 100644 --- a/src/test/groovy/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsFactoryRealSpec.groovy +++ b/src/test/groovy/io/emeraldpay/dshackle/upstream/ethereum/EthereumWsFactoryRealSpec.groovy @@ -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"