Skip to content

Commit

Permalink
[FIXED JENKINS-25788] RunMap.remove was always returning false, even …
Browse files Browse the repository at this point in the history
…when the Run was in fact removed.

(cherry picked from commit ce94579)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and olivergondza committed Jan 6, 2015
1 parent 21a619f commit 14d676b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Expand Up @@ -746,7 +746,7 @@ public synchronized boolean removeValue(R run) {

entrySet.clearCache();

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

/**
Expand Down
20 changes: 17 additions & 3 deletions test/src/test/java/hudson/model/RunMapTest.java
Expand Up @@ -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();
Expand Down Expand Up @@ -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.