mehakmeet commented on a change in pull request #1881: HADOOP-16910 Adding file 
system counters in ABFS
URL: https://github.com/apache/hadoop/pull/1881#discussion_r389370089
 
 

 ##########
 File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsInputStream.java
 ##########
 @@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.fs.azurebfs;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.azurebfs.services.AbfsInputStream;
+
+/**
+ * Test Abfs Input Stream.
+ */
+
+public class ITestAbfsInputStream extends AbstractAbfsIntegrationTest {
+  public ITestAbfsInputStream() throws Exception {
+  }
+
+  /***
+   * {@link AbfsInputStream#incrementReadOps()}
+   *
+   * @throws Exception
+   */
+  @Test
+  public void testAbfsInputStreamReadOps() throws Exception {
+    describe("Test to see correct population of Read operations in Abfs");
+
+    final AzureBlobFileSystem fs = getFileSystem();
+    Path smallFile = new Path("testOneReadCall");
+    Path largeFile = new Path("testLargeReadCalls");
+    FileSystem.Statistics statistics = fs.getFsStatistics();
+    String testReadOps = "test this";
+    statistics.reset();
+
+    //Test for zero read operation
+    Assert.assertEquals(0, statistics.getReadOps());
+
+    FSDataOutputStream outForOneCall = fs.create(smallFile);
+    statistics.reset();
+    outForOneCall.write(testReadOps.getBytes());
+    FSDataInputStream inForOneCall = fs.open(smallFile);
+    inForOneCall.read(testReadOps.getBytes(), 0, 
testReadOps.getBytes().length);
+
+    //Test for one read operation
+    Assert.assertEquals(1, statistics.getReadOps());
+
+    FSDataOutputStream outForLargeCalls = fs.create(largeFile);
 
 Review comment:
   meant to show Large number of operations rather than large read I think. 
I'll change the name for better understanding. still 1000 ops does seem small. 
I'll increase to 10^6 read and write ops then ?

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