Skip to content

Commit 7596a45

Browse files
committed
Improving error reporting when process fails to start
Wrapped PortUtils.waitForPortToOpen with exception handling, when exception is raised log file indicating error is added to exception message Suppressed FileNotException in cleanUpSpec, when process exits abormally since no file is expected and it creates noise
1 parent 9ff567d commit 7596a45

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractServerSmokeTest.groovy

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ abstract class AbstractServerSmokeTest extends AbstractSmokeTest {
6666
(0..<numberOfProcesses).each { idx ->
6767
def port = httpPorts[idx]
6868
def process = testedProcesses[idx]
69-
PortUtils.waitForPortToOpen(port, 240, TimeUnit.SECONDS, process)
69+
70+
try {
71+
PortUtils.waitForPortToOpen(port, 240, TimeUnit.SECONDS, process)
72+
} catch ( Exception e ) {
73+
throw new RuntimeException(e.getMessage() + " - log file " + logFilePaths[idx], e);
74+
}
7075
}
7176
}
7277

@@ -76,7 +81,15 @@ abstract class AbstractServerSmokeTest extends AbstractSmokeTest {
7681
if (null != (outputFile = outputs[idx])) {
7782
// check the structures written out to the log,
7883
// and fail the run if anything unexpected was recorded
79-
verifyLog(idx, outputFile)
84+
try {
85+
verifyLog(idx, outputFile)
86+
} catch ( FileNotFoundException e ) {
87+
if ( testedProcesses[idx].exitValue() == 0 ) {
88+
// suppress file not found exception if process exited abnormally
89+
// just creates confusing noise
90+
throw e;
91+
}
92+
}
8093
}
8194
}
8295
}

0 commit comments

Comments
 (0)