Skip to content

Commit eab08bf

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 ea8cffb commit eab08bf

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
@@ -102,11 +102,16 @@ class ClusterConfiguration {
102102
if (seedNode == node) {
103103
return null
104104
}
105-
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond') {
105+
ant.waitfor(maxwait: '40', maxwaitunit: 'second', checkevery: '500', checkeveryunit: 'millisecond',
106+
timeoutproperty: "failed.${seedNode.transportPortsFile.path}") {
106107
resourceexists {
107108
file(file: seedNode.transportPortsFile.toString())
108109
}
109110
}
111+
if (ant.properties.containsKey("failed.${seedNode.transportPortsFile.path}".toString())) {
112+
throw new GradleException("Failed to locate seed node transport file [${seedNode.transportPortsFile}]: " +
113+
"timed out waiting for it to be created after ${waitSeconds} seconds")
114+
}
110115
return seedNode.transportUri()
111116
}
112117

0 commit comments

Comments
 (0)