mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.7.x'
This commit is contained in:
commit
a036b30822
@ -21,6 +21,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -133,8 +134,10 @@ public class ApplicationRunner extends DefaultTask {
|
|||||||
private void awaitLogging(Process process) {
|
private void awaitLogging(Process process) {
|
||||||
long end = System.currentTimeMillis() + 30000;
|
long end = System.currentTimeMillis() + 30000;
|
||||||
String expectedLogging = this.expectedLogging.get();
|
String expectedLogging = this.expectedLogging.get();
|
||||||
|
List<String> outputLines = Collections.emptyList();
|
||||||
while (System.currentTimeMillis() < end) {
|
while (System.currentTimeMillis() < end) {
|
||||||
for (String line : outputLines()) {
|
outputLines = outputLines();
|
||||||
|
for (String line : outputLines) {
|
||||||
if (line.contains(expectedLogging)) {
|
if (line.contains(expectedLogging)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -143,7 +146,10 @@ public class ApplicationRunner extends DefaultTask {
|
|||||||
throw new IllegalStateException("Process exited before '" + expectedLogging + "' was logged");
|
throw new IllegalStateException("Process exited before '" + expectedLogging + "' was logged");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("'" + expectedLogging + "' was not logged within 30 seconds");
|
StringBuilder message = new StringBuilder(
|
||||||
|
"After 30 seconds '" + expectedLogging + "' had not be logged in the following output:\n\n");
|
||||||
|
outputLines.forEach((line) -> message.append(line).append("\n"));
|
||||||
|
throw new IllegalStateException(message.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> outputLines() {
|
private List<String> outputLines() {
|
||||||
|
Loading…
Reference in New Issue
Block a user