sadanand48 commented on code in PR #4249:
URL: https://github.com/apache/ozone/pull/4249#discussion_r1098760638
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java:
##########
@@ -2209,4 +2209,46 @@ private void createLinkBucket(String linkVolume, String
linkBucket,
OzoneVolume ozoneVolume = objectStore.getVolume(linkVolume);
ozoneVolume.createBucket(linkBucket, builder.build());
}
+
+ @Test
+ public void testSnapshotRead() throws Exception {
+ // Init data
+ OzoneBucket bucket1 =
+ TestDataUtil.createVolumeAndBucket(cluster, bucketLayout);
+ Path volume1Path = new Path(OZONE_URI_DELIMITER, bucket1.getVolumeName());
+ Path bucket1Path = new Path(volume1Path, bucket1.getName());
+ Path file1 = new Path(bucket1Path, "key1");
+ Path file2 = new Path(bucket1Path, "key2");
+
+ ContractTestUtils.touch(fs, file1);
+ ContractTestUtils.touch(fs, file2);
+
+ OzoneBucket bucket2 =
+ TestDataUtil.createVolumeAndBucket(cluster, bucketLayout);
+ Path volume2Path = new Path(OZONE_URI_DELIMITER, bucket2.getVolumeName());
+ Path bucket2Path = new Path(volume2Path, bucket2.getName());
+
+ fs.mkdirs(bucket2Path);
+ Path snapPath1 = fs.createSnapshot(bucket1Path, "snap1");
+ Path snapPath2 = fs.createSnapshot(bucket2Path, "snap1");
+
+ Path file3 = new Path(bucket1Path, "key3");
+ ContractTestUtils.touch(fs, file3);
+
+ Path snapPath3 = fs.createSnapshot(bucket1Path, "snap2");
+
+ try {
+ FileStatus[] f1 = fs.listStatus(snapPath1);
+ FileStatus[] f2 = fs.listStatus(snapPath2);
+ FileStatus[] f3 = fs.listStatus(snapPath3);
+ Assert.assertEquals(2, f1.length);
+ Assert.assertEquals(0, f2.length);
+ Assert.assertEquals(3, f3.length);
+ } catch (Exception e) {
+ Assert.fail("Failed to read/list on snapshotPath, exception: " + e);
+ }
+
Review Comment:
Done.
--
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]