bharatviswa504 commented on a change in pull request #804: HDDS-1496. Support 
partial chunk reads and checksum verification
URL: https://github.com/apache/hadoop/pull/804#discussion_r289977790
 
 

 ##########
 File path: 
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/TestBlockInputStream.java
 ##########
 @@ -174,20 +188,18 @@ public void testSeek() throws Exception {
   }
 
   @Test
-  public void testBlockEOF() throws Exception {
-    // Seek to some position < blockSize and verify EOF is not reached.
-    seekAndVerify(CHUNK_SIZE);
-    Assert.assertFalse(blockInputStream.blockStreamEOF());
-
-    // Seek to blockSize-1 and verify that EOF is not reached as the chunk
-    // has not been read from container yet.
-    seekAndVerify(blockSize-1);
-    Assert.assertFalse(blockInputStream.blockStreamEOF());
-  }
-
-  private void seekAndVerify(int pos) throws Exception {
-    blockInputStream.seek(pos);
-    Assert.assertEquals("Current position of buffer does not match with the " +
-            "seeked position", pos, blockInputStream.getPos());
+  public void testRead() throws Exception {
+    // read 200 bytes of data starting from position 50. Chunk0 contains
+    // indices 0 to 99, chunk1 from 100 to 199 and chunk3 from 200 to 299. So
+    // the read should result in 3 ChunkInputStream reads
+    seekAndVerify(50);
+    byte[] b = new byte[200];
+    blockStream.read(b, 0, 200);
+    matchWithInputData(b, 50, 250);
 
 Review comment:
   Same here too, seek, read and continue with read, verify in the second read, 
we are reading continuing data or not?

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