Skip to content

Commit 623d45c

Browse files
trancexpressiloveeclipse
authored andcommitted
Increase waiting for update jobs in new test, ensure launches are cleaned up on fail
Fixes: #2704
1 parent aa34e37 commit 623d45c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/TestRunListenerTest5.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ public void testTerminateLaunch() throws Exception {
255255
"""
256256
package pack;
257257
import org.junit.jupiter.api.Test;
258-
public class ATestCase {
258+
public class ATestCaseTerminate {
259259
@Test public void testSleep() throws Exception { Thread.sleep(30_000); }
260260
}""";
261-
IType aTestCase= createType(source, "pack", "ATestCase.java");
261+
IType aTestCase= createType(source, "pack", "ATestCaseTerminate.java");
262262

263263
buildTestCase(aTestCase);
264264

@@ -272,7 +272,7 @@ public class ATestCase {
272272
waitForCondition(launchesListener.fLaunchChanged::get, 30 * 1000, 1000);
273273

274274
long scheduledJobsCount = jobListener.scheduledCount.get();
275-
boolean jobCountIncrease= waitForCondition(() -> jobListener.scheduledCount.get() > scheduledJobsCount, 1 * 1000, 100);
275+
boolean jobCountIncrease= waitForCondition(() -> jobListener.scheduledCount.get() > scheduledJobsCount, 5 * 1000, 100);
276276
assertTrue("Expected JUnit update jobs to be scheduled", jobCountIncrease);
277277

278278
terminateLaunches();
@@ -283,6 +283,7 @@ public class ATestCase {
283283
assertFalse("Expected no new JUnit update jobs to be scheduled", jobCountIncrease);
284284
} finally {
285285
jm.removeJobChangeListener(jobListener);
286+
terminateLaunches();
286287
cleanUp(configuration, launchesListener);
287288
}
288289
}

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/TestRunListenerTest6.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ public void testTerminateLaunch() throws Exception {
250250
"""
251251
package pack;
252252
import org.junit.jupiter.api.Test;
253-
public class ATestCase {
253+
public class ATestCaseTerminate {
254254
@Test public void testSleep() throws Exception { Thread.sleep(30_000); }
255255
}""";
256-
IType aTestCase= createType(source, "pack", "ATestCase.java");
256+
IType aTestCase= createType(source, "pack", "ATestCaseTerminate.java");
257257

258258
buildTestCase(aTestCase);
259259

@@ -267,7 +267,7 @@ public class ATestCase {
267267
waitForCondition(launchesListener.fLaunchChanged::get, 30 * 1000, 1000);
268268

269269
long scheduledJobsCount = jobListener.scheduledCount.get();
270-
boolean jobCountIncrease= waitForCondition(() -> jobListener.scheduledCount.get() > scheduledJobsCount, 1 * 1000, 100);
270+
boolean jobCountIncrease= waitForCondition(() -> jobListener.scheduledCount.get() > scheduledJobsCount, 5 * 1000, 100);
271271
assertTrue("Expected JUnit update jobs to be scheduled", jobCountIncrease);
272272

273273
TestRunListenerTest5.terminateLaunches();
@@ -278,6 +278,7 @@ public class ATestCase {
278278
assertFalse("Expected no new JUnit update jobs to be scheduled", jobCountIncrease);
279279
} finally {
280280
jm.removeJobChangeListener(jobListener);
281+
TestRunListenerTest5.terminateLaunches();
281282
cleanUp(configuration, launchesListener);
282283
}
283284
}

0 commit comments

Comments
 (0)