Added waitTime option on engine ATs (#6907)

Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/6915/head
Lucas Saldanha 8 months ago committed by GitHub
parent 001080a72b
commit efd98de5ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/rpc/JsonRpcTestCase.java
  2. 13
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/AbstractJsonRpcTest.java
  3. 8
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/jsonrpc/ExecutionEngineCancunBlockBuildingAcceptanceTest.java
  4. 3
      acceptance-tests/tests/src/test/resources/jsonrpc/engine/cancun/test-cases/block-production/11_cancun_tx_count.json

@ -22,15 +22,18 @@ public class JsonRpcTestCase {
private final JsonNode request;
private final JsonNode response;
private final int statusCode;
private final long waitTime;
@JsonCreator
public JsonRpcTestCase(
@JsonProperty("request") final JsonNode request,
@JsonProperty("response") final JsonNode response,
@JsonProperty("statusCode") final int statusCode) {
@JsonProperty("statusCode") final int statusCode,
@JsonProperty(value = "waitTime", defaultValue = "0") final long waitTime) {
this.request = request;
this.response = response;
this.statusCode = statusCode;
this.waitTime = waitTime;
}
public JsonNode getRequest() {
@ -44,4 +47,8 @@ public class JsonRpcTestCase {
public int getStatusCode() {
return statusCode;
}
public long getWaitTime() {
return waitTime;
}
}

@ -93,6 +93,11 @@ abstract class AbstractJsonRpcTest {
.readTimeout(900, java.util.concurrent.TimeUnit.SECONDS)
.build();
}
if (testCase.getWaitTime() > 0L) {
waitForMillis(testCase.getWaitTime());
}
final Call testRequest =
client.newCall(
new Request.Builder()
@ -112,6 +117,14 @@ abstract class AbstractJsonRpcTest {
.isEqualTo(expectedBody);
}
private static void waitForMillis(final long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
protected void evaluateResponse(
final ObjectNode responseBody,
final Call testRequest,

@ -56,14 +56,6 @@ public class ExecutionEngineCancunBlockBuildingAcceptanceTest extends AbstractJs
final Call testRequest,
final JsonRpcTestCase testCase,
final URL url) {
if (url.toString().endsWith("10_cancun_build_on_genesis.json")) {
// if we just asked the node to build, give it some time to build
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (url.toString().endsWith("12_cancun_get_built_block.json")) {
// final ObjectNode rpcResponse = JsonUtil.objectNodeFromString(response.body().string());

@ -14,5 +14,6 @@
"remoteCount": 0
}
},
"statusCode": 200
"statusCode": 200,
"waitTime": 2000
}
Loading…
Cancel
Save