Skip to content

Commit 2a3becb

Browse files
committed
Stabilize ProcessConsoleTests
Process console and manager maintain few jobs which might be triggered during tests reacting on different console related events. Some of the jobs start with the delay, some have different families. Let wait for all related job families and also give a minimal wait time just in case some async event triggers new job right after we start waiting. Fixes #1033
1 parent c02addc commit 2a3becb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/console/ProcessConsoleTests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void setUp(TestInfo testInfo) throws Exception {
109109
@AfterEach
110110
public void tearDown() throws Exception {
111111
Platform.removeLogListener(errorLogListener);
112+
waitForConsoleRelatedJobs();
112113
for (File tmpFile : tmpFiles) {
113114
tmpFile.delete();
114115
}
@@ -117,6 +118,11 @@ public void tearDown() throws Exception {
117118
assertThat(errorsToStrings()).as("logged errors").isEmpty();
118119
}
119120

121+
private void waitForConsoleRelatedJobs() {
122+
TestUtil.waitForJobs(testInfo.getDisplayName(), ConsoleManager.CONSOLE_JOB_FAMILY, 100, 10000);
123+
TestUtil.waitForJobs(testInfo.getDisplayName(), ProcessConsole.class, 0, 10000);
124+
}
125+
120126
private Stream<String> errorsToStrings() {
121127
return loggedErrors.stream().map(status -> status.toString() + throwableToString(status.getException()));
122128
}
@@ -301,7 +307,7 @@ public void processTerminationTest(ILaunchConfiguration launchConfig, boolean te
301307
waitWhile(() -> !terminationSignaled.get(), () -> "No console complete notification received.");
302308
} finally {
303309
consoleManager.removeConsoles(new IConsole[] { console });
304-
TestUtil.waitForJobs(testInfo.getDisplayName(), ConsoleManager.CONSOLE_JOB_FAMILY, 0, 10000);
310+
waitForConsoleRelatedJobs();
305311
}
306312
}
307313

@@ -419,7 +425,7 @@ private IOConsole doConsoleOutputTest(byte[] testContent, Map<String, Object> la
419425
process.terminate();
420426
}
421427
consoleManager.removeConsoles(new IConsole[] { console });
422-
TestUtil.waitForJobs(testInfo.getDisplayName(), ConsoleManager.CONSOLE_JOB_FAMILY, 0, 1000);
428+
waitForConsoleRelatedJobs();
423429
}
424430
}
425431

0 commit comments

Comments
 (0)