Skip to content
Permalink
Browse files

[FIXED JENKINS-25788] RunMap.remove was always returning false, even …

…when the Run was in fact removed.

(cherry picked from commit ce94579)

Conflicts:
	changelog.html
  • Loading branch information...
jglick authored and olivergondza committed Dec 9, 2014
1 parent 21a619f commit 14d676bb15dbf8ddc3208bd8a80033e831756d49
@@ -746,7 +746,7 @@ public synchronized boolean removeValue(R run) {

entrySet.clearCache();

return unwrap(old)!=null;
return old != null;
}

/**
@@ -9,9 +9,6 @@
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.SleepBuilder;

/**
* @author Kohsuke Kawaguchi
*/
public class RunMapTest {

@Rule public JenkinsRule r = new JenkinsRule();
@@ -73,4 +70,21 @@ public Object readResolve() {

private static boolean bombed;

@Issue("JENKINS-25788")
@Test public void remove() throws Exception {
FreeStyleProject p = r.createFreeStyleProject();
FreeStyleBuild b1 = r.buildAndAssertSuccess(p);
FreeStyleBuild b2 = r.buildAndAssertSuccess(p);
RunMap<FreeStyleBuild> runs = p._getRuns();
assertEquals(2, runs.size());
assertTrue(runs.remove(b1));
assertEquals(1, runs.size());
assertFalse(runs.remove(b1));
assertEquals(1, runs.size());
assertTrue(runs.remove(b2));
assertEquals(0, runs.size());
assertFalse(runs.remove(b2));
assertEquals(0, runs.size());
}

}

0 comments on commit 14d676b

Please sign in to comment.
You can’t perform that action at this time.