HADOOP-15783. [JDK10] TestSFTPFileSystem.testGetModifyTime fails.

This commit is contained in:
Akira Ajisaka 2018-09-25 16:03:28 +09:00
parent 50bc7746d7
commit 93b0f540ed
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -315,6 +315,7 @@ public void testGetAccessTime() throws IOException {
java.nio.file.Path path = (local).pathToFile(file).toPath();
long accessTime1 = Files.readAttributes(path, BasicFileAttributes.class)
.lastAccessTime().toMillis();
// SFTPFileSystem doesn't have milliseconds. Excluding it.
accessTime1 = (accessTime1 / 1000) * 1000;
long accessTime2 = sftpFs.getFileStatus(file).getAccessTime();
assertEquals(accessTime1, accessTime2);
@ -325,6 +326,8 @@ public void testGetModifyTime() throws IOException {
Path file = touch(localFs, name.getMethodName().toLowerCase() + "1");
java.io.File localFile = ((LocalFileSystem) localFs).pathToFile(file);
long modifyTime1 = localFile.lastModified();
// SFTPFileSystem doesn't have milliseconds. Excluding it.
modifyTime1 = (modifyTime1 / 1000) * 1000;
long modifyTime2 = sftpFs.getFileStatus(file).getModificationTime();
assertEquals(modifyTime1, modifyTime2);
}