Skip to content

Commit 147b048

Browse files
committed
Merge branch '2.3.x'
See gh-22909
2 parents 0d8719a + 2b1bb2f commit 147b048

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/RemoteApplicationLauncher.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.function.BiFunction;
2525

2626
import org.awaitility.Awaitility;
27+
import org.awaitility.core.ConditionTimeoutException;
2728

2829
import org.springframework.boot.devtools.RemoteSpringApplication;
2930
import org.springframework.boot.devtools.tests.JvmLauncher.LaunchedJvm;
@@ -77,7 +78,7 @@ private BiFunction<Integer, File, Process> getRemoteRestarter(JvmLauncher javaLa
7778
createRemoteSpringApplicationClassPath(classesDirectory),
7879
RemoteSpringApplication.class.getName(), "--spring.devtools.remote.secret=secret",
7980
"http://localhost:" + port);
80-
awaitRemoteSpringApplication(remoteSpringApplicationJvm.getStandardOut());
81+
awaitRemoteSpringApplication(remoteSpringApplicationJvm);
8182
return remoteSpringApplicationJvm.getProcess();
8283
}
8384
catch (Exception ex) {
@@ -105,10 +106,22 @@ private int awaitServerPort(LaunchedJvm jvm, File serverPortFile) throws Excepti
105106
.getServerPort();
106107
}
107108

108-
private void awaitRemoteSpringApplication(File standardOut) throws Exception {
109-
FileContents contents = new FileContents(standardOut);
110-
Awaitility.waitAtMost(Duration.ofSeconds(30)).until(contents::get,
111-
containsString("Started RemoteSpringApplication"));
109+
private void awaitRemoteSpringApplication(LaunchedJvm launchedJvm) throws Exception {
110+
FileContents contents = new FileContents(launchedJvm.getStandardOut());
111+
try {
112+
Awaitility.waitAtMost(Duration.ofSeconds(30)).until(contents::get,
113+
containsString("Started RemoteSpringApplication"));
114+
}
115+
catch (ConditionTimeoutException ex) {
116+
if (!launchedJvm.getProcess().isAlive()) {
117+
throw new IllegalStateException(
118+
"Process exited with status " + launchedJvm.getProcess().exitValue()
119+
+ " before producing expected standard output.\n\nStandard output:\n\n" + contents.get()
120+
+ "\n\nStandard error:\n\n" + new FileContents(launchedJvm.getStandardError()).get(),
121+
ex);
122+
}
123+
throw ex;
124+
}
112125
}
113126

114127
}

0 commit comments

Comments
 (0)