Skip to content

Commit d9c0ef1

Browse files
authored
Fix enrollment packaging test when running on Java 24 (#123650)
1 parent 1abd7a1 commit d9c0ef1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

qa/packaging/src/test/java/org/elasticsearch/packaging/test/EnrollmentProcessTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,21 @@ private String getEnrollmentToken() throws Exception {
141141
);
142142
}
143143

144-
final String tokenValue = result.stdout()
144+
final List<String> filteredResult = result.stdout()
145145
.lines()
146146
.filter(line -> line.startsWith("WARNING:") == false)
147-
.findFirst()
148-
.orElseThrow(() -> new AssertionError("Failed to find any non-warning output lines"));
149-
enrollmentTokenHolder.set(tokenValue);
147+
.filter(line -> line.matches("\\d{2}:\\d{2}:\\d{2}\\.\\d{3} \\[main\\].*") == false)
148+
.toList();
149+
150+
if (filteredResult.size() > 1) {
151+
throw new AssertionError(
152+
"Result from elasticsearch-create-enrollment-token contains unexpected output. Output was: \n" + result.stdout()
153+
);
154+
} else if (filteredResult.isEmpty()) {
155+
throw new AssertionError("Failed to find any non-warning output lines. Output was: \n" + result.stdout());
156+
}
157+
158+
enrollmentTokenHolder.set(filteredResult.getFirst());
150159
}, 30, TimeUnit.SECONDS);
151160

152161
return enrollmentTokenHolder.get();

0 commit comments

Comments
 (0)