hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject [1/2] hadoop git commit: HADOOP-12540. TestAzureFileSystemInstrumentation#testClientErrorMetrics fails intermittently due to assumption that a lease error will be thrown. Contributed by Gaurav Kanade.
Date Wed, 04 Nov 2015 18:35:07 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 8ed1fd217 -> 81f7e8af2
  refs/heads/trunk e2a5441b0 -> 0fb1867fd


HADOOP-12540. TestAzureFileSystemInstrumentation#testClientErrorMetrics fails intermittently
due to assumption that a lease error will be thrown. Contributed by Gaurav Kanade.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0fb1867f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0fb1867f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0fb1867f

Branch: refs/heads/trunk
Commit: 0fb1867fd62b5df664ad66386d6067db8fbf2317
Parents: e2a5441
Author: cnauroth <cnauroth@apache.org>
Authored: Wed Nov 4 10:19:04 2015 -0800
Committer: cnauroth <cnauroth@apache.org>
Committed: Wed Nov 4 10:28:44 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  4 ++++
 .../TestAzureFileSystemInstrumentation.java     | 25 +++++++++++++-------
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0fb1867f/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index efb73f4..dd70947 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1320,6 +1320,10 @@ Release 2.8.0 - UNRELEASED
 
     HADOOP-12542. TestDNS fails on Windows after HADOOP-12437. (cnauroth)
 
+    HADOOP-12540. TestAzureFileSystemInstrumentation#testClientErrorMetrics
+    fails intermittently due to assumption that a lease error will be thrown.
+    (Gaurav Kanade via cnauroth)
+
   OPTIMIZATIONS
 
     HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0fb1867f/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/metrics/TestAzureFileSystemInstrumentation.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/metrics/TestAzureFileSystemInstrumentation.java
b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/metrics/TestAzureFileSystemInstrumentation.java
index 896ec1b..0c9126c 100644
--- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/metrics/TestAzureFileSystemInstrumentation.java
+++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/metrics/TestAzureFileSystemInstrumentation.java
@@ -48,6 +48,7 @@ import org.apache.hadoop.fs.azure.AzureBlobStorageTestAccount;
 import org.apache.hadoop.fs.azure.AzureException;
 import org.apache.hadoop.fs.azure.AzureNativeFileSystemStore;
 import org.apache.hadoop.fs.azure.NativeAzureFileSystem;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.metrics2.MetricsRecordBuilder;
 import org.apache.hadoop.metrics2.MetricsTag;
 import org.hamcrest.BaseMatcher;
@@ -405,22 +406,30 @@ public class TestAzureFileSystemInstrumentation {
 
   @Test
   public void testClientErrorMetrics() throws Exception {
-    String directoryName = "metricsTestDirectory_ClientError";
-    Path directoryPath = new Path("/" + directoryName);
-    assertTrue(fs.mkdirs(directoryPath));
-    String leaseID = testAccount.acquireShortLease(directoryName);
+    String fileName = "metricsTestFile_ClientError";
+    Path filePath = new Path("/"+fileName);
+    final int FILE_SIZE = 100;
+    OutputStream outputStream = null;
+    String leaseID = null;
     try {
+      // Create a file
+      outputStream = fs.create(filePath);
+      leaseID = testAccount.acquireShortLease(fileName);
       try {
-        fs.delete(directoryPath, true);
-        assertTrue("Should've thrown.", false);
+        outputStream.write(new byte[FILE_SIZE]);
+        outputStream.close();
+        assertTrue("Should've thrown", false);
       } catch (AzureException ex) {
         assertTrue("Unexpected exception: " + ex,
-            ex.getMessage().contains("lease"));
+          ex.getMessage().contains("lease"));
       }
       assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_CLIENT_ERRORS));
       assertEquals(0, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_SERVER_ERRORS));
     } finally {
-      testAccount.releaseLease(leaseID, directoryName);
+      if(leaseID != null){
+        testAccount.releaseLease(leaseID, fileName);
+      }
+      IOUtils.closeStream(outputStream);
     }
   }
 


Mime
View raw message