Skip to content

Commit

Permalink
Update core/src/test/java/hudson/model/RunTest.java
Browse files Browse the repository at this point in the history
Added testParseTimestampFromBuildDir to deal with JENKINS-15587.
  • Loading branch information
aleksas committed Jan 24, 2013
1 parent 3d85071 commit 548503c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions core/src/test/java/hudson/model/RunTest.java
Expand Up @@ -76,5 +76,33 @@ public String call() throws Exception {
TimeZone.setDefault(origTZ);
}
}


@Bug(15587)
@Test
public void testParseTimestampFromBuildDir() throws Exception {
//Assume.assumeTrue(!Functions.isWindows() || (NTFS && JAVA7) || ...);

String buildDateTime = "2012-12-21_14-02-28";
long buildTimestamp = 1356091348000L;
int buildNumber = 155;

ByteArrayOutputStream baos = new ByteArrayOutputStream();
StreamTaskListener l = new StreamTaskListener(baos);

File tempDir = Util.createTempDir();
File buildDir = new File(tempDir, buildDateTime);
assertEquals(buildDir.mkdir(), true);
File buildDirSymLink = new File(tempDir, Integer.toString(buildNumber));

try {
buildDir.mkdir();

Util.createSymlink(tempDir, buildDir.getAbsolutePath(), buildDirSymLink.getName(), l);
assertEquals(Run.parseTimestampFromBuildDir(buildDirSymLink), buildTimestamp);
} finally {
Util.deleteRecursive(tempDir);
}
}

}

0 comments on commit 548503c

Please sign in to comment.