You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jyotirmoy-gh (via GitHub)" <gi...@apache.org> on 2023/01/23 14:14:05 UTC

[GitHub] [ozone] jyotirmoy-gh opened a new pull request, #4198: HDDS-7819. [snapshot] Add unit-testcases for fs delete of bucket havng snapshots

jyotirmoy-gh opened a new pull request, #4198:
URL: https://github.com/apache/ozone/pull/4198

   ## What changes were proposed in this pull request?
   
   Add unit-testcases for fs delete of bucket havng snapshots - `TestOzoneFsSnapshot#testDeleteBucketWithSnapshot`
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7819
   
   ## How was this patch tested?
   
   Testcase file - `hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java`
   ```
   mvn -Dtest=TestOzoneFsSnapshot#testDeleteBucketWithSnapshot test
   [INFO] -------------------------------------------------------
   [INFO]  T E S T S
   [INFO] -------------------------------------------------------
   [INFO] Running org.apache.hadoop.fs.ozone.TestOzoneFsSnapshot
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 54.886 s - in org.apache.hadoop.fs.ozone.TestOzoneFsSnapshot
   [INFO]
   [INFO] Results:
   [INFO]
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   [INFO]
   ```
   


-- 
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


[GitHub] [ozone] smengcl merged pull request #4198: HDDS-7819. [snapshot] Add unit-testcases for fs delete of bucket havng snapshots

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #4198:
URL: https://github.com/apache/ozone/pull/4198


-- 
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


[GitHub] [ozone] smengcl commented on pull request #4198: HDDS-7819. [Snapshot] Add unit-testcases for fs delete of bucket havng snapshots

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on PR #4198:
URL: https://github.com/apache/ozone/pull/4198#issuecomment-1404576707

   Thanks @jyotirmoy-gh for the patch. Thanks @prashantpogde for the review.


-- 
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


[GitHub] [ozone] jyotirmoy-gh commented on pull request #4198: HDDS-7819. [snapshot] Add unit-testcases for fs delete of bucket havng snapshots

Posted by "jyotirmoy-gh (via GitHub)" <gi...@apache.org>.
jyotirmoy-gh commented on PR #4198:
URL: https://github.com/apache/ozone/pull/4198#issuecomment-1400430370

   @smengcl @sadanand48 @nilotpalnandi - Please review


-- 
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


[GitHub] [ozone] smengcl commented on a diff in pull request #4198: HDDS-7819. [snapshot] Add unit-testcases for fs delete of bucket havng snapshots

Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #4198:
URL: https://github.com/apache/ozone/pull/4198#discussion_r1084629987


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java:
##########
@@ -278,4 +278,35 @@ public void testCreateSnapshotParameterMissing() throws Exception {
       shell.close();
     }
   }
+
+  @Test
+  public void testDeleteBucketWithSnapshot() throws Exception {
+    String volume = "vol-" + RandomStringUtils.randomNumeric(5);
+    String bucket = "buc-" + RandomStringUtils.randomNumeric(5);
+    String key = "key-" + RandomStringUtils.randomNumeric(5);
+    String snapshotName = "snap-" + RandomStringUtils.randomNumeric(5);
+
+    String testVolBucket = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket;
+    String testKey = testVolBucket + OM_KEY_PREFIX + key;
+
+    createVolBuckKey(testVolBucket, testKey);
+
+    OzoneFsShell shell = new OzoneFsShell(clientConf);
+    try {
+      int res = ToolRunner.run(shell,
+              new String[]{"-createSnapshot", testVolBucket, snapshotName});
+      // Asserts that create request succeeded
+      assertEquals(0, res);
+
+      res = ToolRunner.run(shell,
+              new String[]{"-rm", "-r", "-skipTrash", testKey});
+      assertEquals(0, res);
+
+      res = ToolRunner.run(shell,
+              new String[]{"-rm", "-r", "-skipTrash", testVolBucket});
+      assertEquals(1, res);
+    } finally {

Review Comment:
   Should there be one more check (or two) to verify that the bucket and the snapshot still exist?



-- 
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


[GitHub] [ozone] jyotirmoy-gh commented on a diff in pull request #4198: HDDS-7819. [snapshot] Add unit-testcases for fs delete of bucket havng snapshots

Posted by "jyotirmoy-gh (via GitHub)" <gi...@apache.org>.
jyotirmoy-gh commented on code in PR #4198:
URL: https://github.com/apache/ozone/pull/4198#discussion_r1085411920


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsSnapshot.java:
##########
@@ -278,4 +278,35 @@ public void testCreateSnapshotParameterMissing() throws Exception {
       shell.close();
     }
   }
+
+  @Test
+  public void testDeleteBucketWithSnapshot() throws Exception {
+    String volume = "vol-" + RandomStringUtils.randomNumeric(5);
+    String bucket = "buc-" + RandomStringUtils.randomNumeric(5);
+    String key = "key-" + RandomStringUtils.randomNumeric(5);
+    String snapshotName = "snap-" + RandomStringUtils.randomNumeric(5);
+
+    String testVolBucket = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket;
+    String testKey = testVolBucket + OM_KEY_PREFIX + key;
+
+    createVolBuckKey(testVolBucket, testKey);
+
+    OzoneFsShell shell = new OzoneFsShell(clientConf);
+    try {
+      int res = ToolRunner.run(shell,
+              new String[]{"-createSnapshot", testVolBucket, snapshotName});
+      // Asserts that create request succeeded
+      assertEquals(0, res);
+
+      res = ToolRunner.run(shell,
+              new String[]{"-rm", "-r", "-skipTrash", testKey});
+      assertEquals(0, res);
+
+      res = ToolRunner.run(shell,
+              new String[]{"-rm", "-r", "-skipTrash", testVolBucket});
+      assertEquals(1, res);
+    } finally {

Review Comment:
   I have added checks for bucket and snapshot. The snapshot check is failing presently due to - https://issues.apache.org/jira/browse/HDDS-7805 



-- 
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