Skip to content

Commit 2ccf579

Browse files
authored
Merge pull request #463 from RanjitCS/fix-assertgc-soft-ref
Allow soft references in FlowExecutionListTest leak assertions
2 parents 2ff1a5e + 784d2db commit 2ccf579

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/test/java/org/jenkinsci/plugins/workflow/flow/FlowExecutionListTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ public class FlowExecutionListTest {
226226
notStuck.getLazyBuildMixIn().removeRun(notStuckBuild);
227227
notStuckBuild = null; // Clear out the local variable in this thread.
228228
Jenkins.get().getQueue().clearLeftItems(); // Otherwise we'd have to wait 5 minutes for the cache to be cleared.
229-
// Make sure that the reference can be GC'd.
230-
MemoryAssert.assertGC(notStuckBuildRef, false);
229+
// Allow soft references from JVM and Groovy caches (Introspector, MetaClass)
230+
// that are unrelated to the StepExecutionIterator code under test
231+
MemoryAssert.assertGC(notStuckBuildRef, true);
231232
// Allow stuck #1 to complete so the test can be cleaned up promptly.
232233
SynchronousBlockingStep.unblock("stuck");
233234
r.waitForCompletion(stuckBuild);
@@ -263,8 +264,9 @@ public class FlowExecutionListTest {
263264
notStuck.getLazyBuildMixIn().removeRun(notStuckBuild);
264265
notStuckBuild = null; // Clear out the local variable in this thread.
265266
Jenkins.get().getQueue().clearLeftItems(); // Otherwise we'd have to wait 5 minutes for the cache to be cleared.
266-
// Make sure that the reference can be GC'd.
267-
MemoryAssert.assertGC(notStuckBuildRef, false);
267+
// Allow soft references from JVM and Groovy caches (Introspector, MetaClass)
268+
// that are unrelated to the StepExecutionIterator code under test
269+
MemoryAssert.assertGC(notStuckBuildRef, true);
268270
// Allow stuck #1 to complete so the test can be cleaned up promptly.
269271
r.waitForMessage("Still trying to load StuckPickle for", stuckBuild);
270272
ExtensionList.lookupSingleton(StuckPickle.Factory.class).resolved = new StuckPickle.Marker();

0 commit comments

Comments
 (0)