Skip to content

Commit

Permalink
Use common timeout for RuntimeProcessTests eclipse-platform#863
Browse files Browse the repository at this point in the history
The test methods of RuntimeProcessTests use different and rather low
timeout values. Depending on the execution environment, the timeouts may
be exceeded and could be a reason for random failures of these tests.

The change replaces all custom timeout values with the common timeout
already defined in AbstractDebugTest.

Contributes to
eclipse-platform#863
  • Loading branch information
HeikoKlare committed Dec 18, 2023
1 parent fb17185 commit c2165a3
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public void testProcessTerminated() throws Exception {
mockProcess.setExitValue(1);
mockProcess.destroy();

TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
TestUtil.waitForJobs(name.getMethodName(), 25, 500);
TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, testTimeout, p -> "RuntimeProcess not terminated.");
TestUtil.waitForJobs(name.getMethodName(), 25, testTimeout);
assertEquals("Wrong number of terminate events.", 1, processTerminateEvents.get());
assertEquals("RuntimeProcess reported wrong exit code.", 1, runtimeProcess.getExitValue());
}
Expand All @@ -92,8 +92,8 @@ public void testTerminateProcess() throws Exception {
runtimeProcess.terminate();
assertFalse("RuntimeProcess failed to terminate wrapped process.", mockProcess.isAlive());

TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
TestUtil.waitForJobs(name.getMethodName(), 25, 500);
TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, testTimeout, p -> "RuntimeProcess not terminated.");
TestUtil.waitForJobs(name.getMethodName(), 25, testTimeout);
assertEquals("Wrong number of terminate events.", 1, processTerminateEvents.get());
assertEquals("RuntimeProcess reported wrong exit code.", 1, runtimeProcess.getExitValue());
}
Expand Down Expand Up @@ -129,7 +129,7 @@ public void testTerminateProcessWithSubProcesses() throws Exception {
assertFalse("RuntimeProcess failed to terminate child of wrapped process.", childProcess2.isAlive());
assertFalse("RuntimeProcess failed to terminate descendant of wrapped process.", grandChildProcess.isAlive());

TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, testTimeout, p -> "RuntimeProcess not terminated.");
}

/**
Expand All @@ -154,7 +154,7 @@ public void testTerminateProcessWithoutTerminatingDescendents() throws Exception
assertFalse("RuntimeProcess failed to terminate wrapped process.", mockProcess.isAlive());
assertTrue("RuntimeProcess terminated child of wrapped process, unlike configured.", childProcess.isAlive());

TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, testTimeout, p -> "RuntimeProcess not terminated.");
}

/**
Expand All @@ -173,7 +173,7 @@ public void testTerminateProcessNotSupportingProcessToHandle() throws Exception
RuntimeProcess runtimeProcess = mockProcess.toRuntimeProcess();
runtimeProcess.terminate(); // must not throw, even toHandle() does

TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, 1000, p -> "RuntimePocess not terminated.");
TestUtil.waitWhile(p -> !p.isTerminated(), runtimeProcess, testTimeout, p -> "RuntimeProcess not terminated.");
}

/**
Expand Down

0 comments on commit c2165a3

Please sign in to comment.