Skip to content

Commit

Permalink
[JENKINS-40949] Use a minimum set of permalinks instead of a fixed set
Browse files Browse the repository at this point in the history
This way the test works with the same guarantees for 1.x series and works
for 2.x series
  • Loading branch information
raul-arabaolaza authored and aheritier committed Jan 11, 2017
1 parent 6fcec84 commit a95a0e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/test/java/hudson/maven/MavenMultiModuleTest.java
Expand Up @@ -23,6 +23,7 @@
import java.io.File;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
Expand Down Expand Up @@ -73,11 +74,15 @@ public class MavenMultiModuleTest {
assertEquals(2, mms.getLastStableBuild().number);
assertEquals("2", Util.resolveSymlink(new File(mms.getBuildDir(), "lastStableBuild")));
assertEquals("builds/lastStableBuild", Util.resolveSymlink(new File(mms.getRootDir(), "lastStable")));
assertEquals("[lastBuild, lastStableBuild, lastSuccessfulBuild]", permalinks(mms).toString());
// The number of builtin permalinks changed in jenkins 2.x so we can not use a strict comparision if we want
// cross version passing tests
assertTrue(permalinks(mms).containsAll(Arrays.asList("lastBuild", "lastStableBuild", "lastSuccessfulBuild")));
assertEquals(2, mm.getLastStableBuild().number);
assertEquals("2", Util.resolveSymlink(new File(mm.getBuildDir(), "lastStableBuild")));
assertEquals("builds/lastStableBuild", Util.resolveSymlink(new File(mm.getRootDir(), "lastStable")));
assertEquals("[lastBuild, lastStableBuild, lastSuccessfulBuild]", permalinks(mm).toString());
// The number of builtin permalinks changed in jenkins 2.x so we can not use a strict comparision if we want
// cross version passing tests
assertTrue(permalinks(mm).containsAll(Arrays.asList("lastBuild", "lastStableBuild", "lastSuccessfulBuild")));
}
private static Set<String> permalinks(Job<?,?> j) {
Set<String> r = new TreeSet<String>();
Expand Down

0 comments on commit a95a0e9

Please sign in to comment.