You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/10/28 04:53:55 UTC
[GitHub] [ozone] smengcl commented on a diff in pull request #3896: HDDS-7427. [Snapshot] Add unit-testcases for Ozone snapshot feature.
smengcl commented on code in PR #3896:
URL: https://github.com/apache/ozone/pull/3896#discussion_r1007616957
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOmSnapshot.java:
##########
@@ -383,6 +340,78 @@ public void checkKey() throws Exception {
snapshotKeyPrefix + key1);
}
+ @Test
+ public void testListDeleteKey()
+ throws IOException, InterruptedException, TimeoutException {
+ String volume = "vol-" + RandomStringUtils.randomNumeric(5);
+ String bucket = "buc-" + RandomStringUtils.randomNumeric(5);
+ store.createVolume(volume);
+ OzoneVolume vol = store.getVolume(volume);
+ vol.createBucket(bucket);
+ OzoneBucket volbucket = vol.getBucket(bucket);
+
+ String key = "key-";
+ createFileKey(volbucket, key);
+ String snapshotKeyPrefix = createSnapshot(volume, bucket);
+ deleteKeys(volbucket);
+
+ Iterator<? extends OzoneKey> volBucketIter =
+ volbucket.listKeys(snapshotKeyPrefix + "key-");
+ int volBucketKeyCount = 0;
+ while (volBucketIter.hasNext()) {
+ volBucketIter.next();
+ volBucketKeyCount++;
+ }
+ Assert.assertEquals(1, volBucketKeyCount);
+
+ snapshotKeyPrefix = createSnapshot(volume, bucket);
+ Iterator<? extends OzoneKey> volBucketIter2 =
+ volbucket.listKeys(snapshotKeyPrefix);
+ while (volBucketIter2.hasNext()) {
+ fail();
Review Comment:
nit: add a sensible message explaining what is the expected outcome to assist other dev when debugging this UT just in case it fails. e.g.
```suggestion
fail("The last snapshot should not have any keys in it!");
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org