From 93b0f540ed52f31c53fe4afc6d423e64c57c0af2 Mon Sep 17 00:00:00 2001 From: Akira Ajisaka Date: Tue, 25 Sep 2018 16:03:28 +0900 Subject: [PATCH] HADOOP-15783. [JDK10] TestSFTPFileSystem.testGetModifyTime fails. --- .../java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java index af48cb6169..96f6fb9f02 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java @@ -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); }