yandrey321 commented on code in PR #11971:
URL: https://github.com/apache/ozone/pull/11971#discussion_r4566331839
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractRootedOzoneFileSystemTest.java:
##########
@@ -280,6 +282,35 @@ void testUserHomeDirectory() {
userOfs.getHomeDirectory());
}
+ /**
+ * Like HDFS, getFileStatus has no block locations (HDDS-17714):
getFileBlockLocations fetches them, for a status
+ * and for a path.
+ */
+ @Test
+ void testGetFileBlockLocations() throws Exception {
+ Path path = new Path(bucketPath, "testGetFileBlockLocations");
+ byte[] data = ContractTestUtils.dataset(1024, 'a', 26);
+ ContractTestUtils.createFile(fs, path, true, data);
+
+ FileStatus status = fs.getFileStatus(path);
+ assertFalse(status instanceof LocatedFileStatus);
+ assertEquals(data.length, status.getLen());
+
+ BlockLocation[] expected =
fs.listLocatedStatus(path).next().getBlockLocations();
+ assertThat(expected.length).isGreaterThanOrEqualTo(1);
+ for (BlockLocation[] blockLocations : new BlockLocation[][] {
+ fs.getFileBlockLocations(status, 0, status.getLen()),
fs.getFileBlockLocations(path, 0, status.getLen())}) {
+ assertEquals(expected.length, blockLocations.length);
+ for (int i = 0; i < expected.length; i++) {
+
assertThat(blockLocations[i].getNames().length).isGreaterThanOrEqualTo(1);
+ assertArrayEquals(expected[i].getHosts(),
blockLocations[i].getHosts());
+ assertEquals(expected[i].getOffset(), blockLocations[i].getOffset());
+ assertEquals(expected[i].getLength(), blockLocations[i].getLength());
+ }
+ }
+ fs.delete(path, false);
Review Comment:
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]