Skip to content
Permalink
Browse files

[JENKINS-40949] Use a minimum set of permalinks instead of a fixed set

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 10, 2017
1 parent 6fcec84 commit a95a0e9927cc3c4824a6bec76d1c2ba00202772c
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/test/java/hudson/maven/MavenMultiModuleTest.java
@@ -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;
@@ -73,11 +74,15 @@
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>();

0 comments on commit a95a0e9

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