hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asur...@apache.org
Subject [28/50] [abbrv] hadoop git commit: HADOOP-12588. Fix intermittent test failure of TestGangliaMetrics. Contributed by Masatake Iwasaki.
Date Tue, 22 Dec 2015 23:51:27 GMT
HADOOP-12588. Fix intermittent test failure of TestGangliaMetrics. Contributed by Masatake
Iwasaki.


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

Branch: refs/heads/yarn-2877
Commit: bd5e207432c54cc75fd8c040e232241678987e53
Parents: 6da9dee
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Fri Dec 18 13:12:33 2015 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Fri Dec 18 13:12:33 2015 +0900

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt           |  3 +++
 .../apache/hadoop/metrics2/impl/TestGangliaMetrics.java   | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bd5e2074/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 3c98ead..9bd4d6e 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1550,6 +1550,9 @@ Release 2.7.3 - UNRELEASED
     HADOOP-12602. TestMetricsSystemImpl#testQSize occasionally fails.
     (Masatake Iwasaki via aajisaka)
 
+    HADOOP-12588. Fix intermittent test failure of TestGangliaMetrics.
+    (Masatake Iwasaki via aajisaka)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/bd5e2074/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
index e097a0f..c386e36 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java
@@ -29,7 +29,9 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
 
+import org.apache.commons.io.Charsets;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.metrics2.AbstractMetric;
@@ -145,7 +147,7 @@ public class TestGangliaMetrics {
   private void checkMetrics(List<byte[]> bytearrlist, int expectedCount) {
     boolean[] foundMetrics = new boolean[expectedMetrics.length];
     for (byte[] bytes : bytearrlist) {
-      String binaryStr = new String(bytes);
+      String binaryStr = new String(bytes, Charsets.UTF_8);
       for (int index = 0; index < expectedMetrics.length; index++) {
         if (binaryStr.indexOf(expectedMetrics[index]) >= 0) {
           foundMetrics[index] = true;
@@ -188,13 +190,13 @@ public class TestGangliaMetrics {
    * hence all the captured byte arrays were pointing to one instance.
    */
   private class MockDatagramSocket extends DatagramSocket {
-    private ArrayList<byte[]> capture;
+    private List<byte[]> capture;
 
     /**
      * @throws SocketException
      */
     public MockDatagramSocket() throws SocketException {
-      capture = new  ArrayList<byte[]>();
+      capture = new CopyOnWriteArrayList<byte[]>();
     }
 
     /* (non-Javadoc)
@@ -211,7 +213,7 @@ public class TestGangliaMetrics {
     /**
      * @return the captured byte arrays
      */
-    ArrayList<byte[]> getCapturedSend() {
+    List<byte[]> getCapturedSend() {
       return capture;
     }
   }


Mime
View raw message