Skip to content

Commit 141c9e9

Browse files
macfarlaahamlat
authored andcommitted
potential fix for race condidion affecting ATs (besu-eth#9929)
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com> Signed-off-by: Ameziane H. <ameziane.hamlat@consensys.net>
1 parent bb5dfd7 commit 141c9e9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,14 @@ private String getDiscoveryPort() {
365365

366366
public Optional<String> jsonRpcBaseUrl() {
367367
if (isJsonRpcEnabled()) {
368-
return Optional.of(
369-
HTTP + jsonRpcConfiguration.getHost() + ":" + portsProperties.getProperty(JSON_RPC));
368+
final String port = portsProperties.getProperty(JSON_RPC);
369+
if (port == null) {
370+
throw new IllegalStateException(
371+
"JSON-RPC port not available for node "
372+
+ name
373+
+ ". Node may have failed to start or ports file was not written.");
374+
}
375+
return Optional.of(HTTP + jsonRpcConfiguration.getHost() + ":" + port);
370376
} else {
371377
return Optional.empty();
372378
}

acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,13 @@ private void waitForFileOrExit(final BesuNode node, final String fileName) {
461461
Awaitility.waitAtMost(60, TimeUnit.SECONDS)
462462
.until(
463463
() -> {
464-
if (!besuProcesses.get(node.getName()).isAlive()) {
464+
final Process process = besuProcesses.get(node.getName());
465+
if (!process.isAlive()) {
466+
LOG.warn(
467+
"Besu process for node {} exited with code {} before writing {}",
468+
node.getName(),
469+
process.exitValue(),
470+
fileName);
465471
return true;
466472
}
467473

0 commit comments

Comments
 (0)