nandakumar131 commented on a change in pull request #72: HDDS-2341. Validate 
tar entry path during extraction
URL: https://github.com/apache/hadoop-ozone/pull/72#discussion_r338072825
 
 

 ##########
 File path: 
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestTarContainerPacker.java
 ##########
 @@ -188,13 +184,139 @@ public void pack() throws IOException, 
CompressorException {
     assertExampleChunkFileIsGood(
         Paths.get(destinationContainerData.getChunksPath()));
     Assert.assertFalse(
-        "Descriptor file should not been exctarcted by the "
+        "Descriptor file should not have been extracted by the "
             + "unpackContainerData Call",
         destinationContainer.getContainerFile().exists());
     Assert.assertEquals(TEST_DESCRIPTOR_FILE_CONTENT, descriptor);
+  }
+
+  @Test
+  public void unpackContainerDataWithValidRelativeDbFilePath()
+      throws Exception {
+    //GIVEN
+    KeyValueContainerData sourceContainerData =
+        createContainer(SOURCE_CONTAINER_ROOT);
+
+    String fileName = "sub/dir/" + TEST_DB_FILE_NAME;
+    File file = writeDbFile(sourceContainerData, fileName);
+    String entryName = TarContainerPacker.DB_DIR_NAME + "/" + fileName;
+
+    File containerFile = packContainerWithSingleFile(file, entryName);
+
+    // WHEN
+    unpackContainerData(containerFile);
+
+    // THEN
+    assertExampleMetadataDbIsGood(file.toPath().getParent());
 
 Review comment:
   The assertion here is done on source container itself, is this intentional?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to