sumangala-patki commented on a change in pull request #2698:
URL: https://github.com/apache/hadoop/pull/2698#discussion_r581200495



##########
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRandomRead.java
##########
@@ -405,6 +418,27 @@ public void testSkipAndAvailableAndPosition() throws 
Exception {
     }
   }
 
+  @Test
+  public void testZeroByteFile() throws Exception {
+    Path emptyFile = new Path("/emptyFile");
+    getFileSystem().create(emptyFile);
+    FSDataInputStream in = getFileSystem().open(emptyFile);
+    assertEquals("Initial position of inputstream in empty file is 0", 0,
+        in.getPos());
+    in.seek(0);
+    assertEquals("Seek to 0 should succeed", 0, in.getPos());
+    in.skip(0);

Review comment:
       added assertion

##########
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemRandomRead.java
##########
@@ -203,23 +203,36 @@ public void testSkipBounds() throws Exception {
 
       assertTrue(testFileLength > 0);
 
-      skipped = inputStream.skip(testFileLength);
-      assertEquals(testFileLength, skipped);
+      //test skip to EOF with correct input skip count
+      assertEquals("Position should be 0", 0, inputStream.getPos());
+      inputStream.skip(testFileLength - 1);
+      assertEquals("Position should be EOF", testFileLength - 1,
+          inputStream.getPos());
 
-      intercept(EOFException.class,
-              new Callable<Long>() {
-                @Override
-                public Long call() throws Exception {
-                  return inputStream.skip(1);
-                }
-              }
-      );
       long elapsedTimeMs = timer.elapsedTimeMs();
       assertTrue(
-              String.format(
-                      "There should not be any network I/O 
(elapsedTimeMs=%1$d).",
-                      elapsedTimeMs),
-              elapsedTimeMs < MAX_ELAPSEDTIMEMS);
+          String.format(
+              "There should not be any network I/O (elapsedTimeMs=%1$d).",
+              elapsedTimeMs),
+          elapsedTimeMs < MAX_ELAPSEDTIMEMS);
+
+      //test negative skip from last valid position
+      skipped = inputStream.skip(-testFileLength+1);

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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to