Skip to content

Commit 5957c10

Browse files
committed
Reworking exception handling logic around verifyLog
Modifying exception handling logic around verifyLog in response to review feedback When process is alive or exited normally, the exception flows through as is When process exited abnormally, the exception is wrapped in another exception that indicates the abnormal termination
1 parent 89de4b3 commit 5957c10

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,20 @@ abstract class AbstractServerSmokeTest extends AbstractSmokeTest {
8585
try {
8686
verifyLog(idx, outputFile)
8787
} catch ( FileNotFoundException e ) {
88-
if ( !testedProcesses[idx].isAlive() && testedProcesses[idx].exitValue() == 0 ) {
89-
// suppress file not found exception if process exited abnormally
90-
// just creates confusing noise
88+
if ( testedProcesses[idx].isAlive() ) {
9189
throw e
9290
}
91+
92+
def exitCode = testedProesses[idx].exitValue()
93+
if ( exitCode == 0 ) {
94+
throw e
95+
} else {
96+
def logFile = logFilePaths[idx]
97+
// highlight when process exited abnormally, since that may have contributed
98+
// to the log verification failure
99+
throw new RuntimeException(
100+
"Server process exited abnormally - exit code: ${exitCode}; check log file: ${logFile}", e)
101+
}
93102
}
94103
}
95104
}

0 commit comments

Comments
 (0)