Skip to content

Commit 87b61cd

Browse files
authored
Add an exception throw if waiting on transport port file fails (#37574)
In the ClusterConfiguration class of the build source, there is an Ant waitfor block that runs to ensure that the seed node's transport ports file is created before trying to read it. If the wait times out, the file read fails with not much helpful info. This just adds a timeout property to the waitfor block and throws a descriptive exception instead. Backports #37574
1 parent f166926 commit 87b61cd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterConfiguration.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,16 @@ class ClusterConfiguration {
118118
if (seedNode == node) {
119119
return null
120120
}
121-
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond') {
121+
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond',
122+
timeoutproperty: "failed.${seedNode.transportPortsFile.path}") {
122123
resourceexists {
123124
file(file: seedNode.transportPortsFile.toString())
124125
}
125126
}
127+
if (ant.properties.containsKey("failed.${seedNode.transportPortsFile.path}".toString())) {
128+
throw new GradleException("Failed to locate seed node transport file [${seedNode.transportPortsFile}]: " +
129+
"timed out waiting for it to be created after ${waitSeconds} seconds")
130+
}
126131
return seedNode.transportUri()
127132
}
128133

0 commit comments

Comments
 (0)