Java 7 doesn't have Process.waitFor(time) so use Spock's timeout
package datadog.smoketest
+import spock.lang.Timeout
import java.util.concurrent.TimeUnit
class CliApplicationSmokeTest extends AbstractSmokeTest {
// Estimate for the amount of time instrumentation, plus request, plus some extra
- private static final long TIMEOUT_SECS = 10
+ private static final int TIMEOUT_SECS = 10
@Override
ProcessBuilder createProcessBuilder() {
@@ -19,10 +20,9 @@ class CliApplicationSmokeTest extends AbstractSmokeTest {
processBuilder.directory(new File(buildDirectory))
}
+ @Timeout(value = TIMEOUT_SECS, unit = TimeUnit.SECONDS)
def "Cli application process ends before timeout"() {
expect:
- assert serverProcess.waitFor(TIMEOUT_SECS, TimeUnit.SECONDS)
-
- assert serverProcess.exitValue() == 0
+ assert serverProcess.waitFor() == 0
}
}
