You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2018/05/17 20:37:29 UTC

[1/4] hadoop git commit: HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

Repository: hadoop
Updated Branches:
  refs/heads/branch-2 33dfbed8d -> b87cd6354
  refs/heads/branch-3.0 fb0a258b3 -> d3457b38e
  refs/heads/branch-3.1 0460201c3 -> e5ff9f392
  refs/heads/trunk 328f0847e -> 26f1e22fc


HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.


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

Branch: refs/heads/trunk
Commit: 26f1e22fc9ee326e9c76503d347552faeb6c2d3b
Parents: 328f084
Author: Inigo Goiri <in...@apache.org>
Authored: Thu May 17 13:35:09 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Thu May 17 13:35:09 2018 -0700

----------------------------------------------------------------------
 .../datanode/web/TestDatanodeHttpXFrame.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/26f1e22f/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
index 9ecd8ea..62827a2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.http.HttpServer2;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -36,13 +37,24 @@ import java.net.URL;
  * Test that X-Frame-Options works correctly with DatanodeHTTPServer.
  */
 public class TestDatanodeHttpXFrame {
+
+  private MiniDFSCluster cluster = null;
+
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
+  @After
+  public void cleanUp() {
+    if (cluster != null) {
+      cluster.shutdown();
+      cluster = null;
+    }
+  }
+
   @Test
   public void testDataNodeXFrameOptionsEnabled() throws Exception {
     boolean xFrameEnabled = true;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("X-FRAME-OPTIONS is absent in the header",
@@ -54,7 +66,7 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testNameNodeXFrameOptionsDisabled() throws Exception {
     boolean xFrameEnabled = false;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("unexpected X-FRAME-OPTION in header", xfoHeader == null);
@@ -63,25 +75,25 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testDataNodeXFramewithInvalidOptions() throws Exception {
     exception.expect(IllegalArgumentException.class);
-    createCluster(false, "Hadoop");
+    cluster = createCluster(false, "Hadoop");
   }
 
-  private MiniDFSCluster createCluster(boolean enabled, String
+  private static MiniDFSCluster createCluster(boolean enabled, String
       value) throws IOException {
     Configuration conf = new HdfsConfiguration();
     conf.setBoolean(DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED, enabled);
     if (value != null) {
       conf.set(DFSConfigKeys.DFS_XFRAME_OPTION_VALUE, value);
     }
-    MiniDFSCluster cluster =
+    MiniDFSCluster dfsCluster =
         new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
-    cluster.waitActive();
-    return cluster;
+    dfsCluster.waitActive();
+    return dfsCluster;
   }
 
-  private HttpURLConnection getConn(MiniDFSCluster cluster)
+  private static HttpURLConnection getConn(MiniDFSCluster dfsCluster)
       throws IOException {
-    DataNode datanode = cluster.getDataNodes().get(0);
+    DataNode datanode = dfsCluster.getDataNodes().get(0);
     URL newURL = new URL("http://localhost:" + datanode.getInfoPort());
     HttpURLConnection conn = (HttpURLConnection) newURL.openConnection();
     conn.connect();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[4/4] hadoop git commit: HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

Posted by in...@apache.org.
HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

(cherry picked from commit 26f1e22fc9ee326e9c76503d347552faeb6c2d3b)


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

Branch: refs/heads/branch-2
Commit: b87cd6354b2956e98db3fc9ee7d935483eb3c63c
Parents: 33dfbed
Author: Inigo Goiri <in...@apache.org>
Authored: Thu May 17 13:35:09 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Thu May 17 13:36:53 2018 -0700

----------------------------------------------------------------------
 .../datanode/web/TestDatanodeHttpXFrame.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b87cd635/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
index 9ecd8ea..62827a2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.http.HttpServer2;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -36,13 +37,24 @@ import java.net.URL;
  * Test that X-Frame-Options works correctly with DatanodeHTTPServer.
  */
 public class TestDatanodeHttpXFrame {
+
+  private MiniDFSCluster cluster = null;
+
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
+  @After
+  public void cleanUp() {
+    if (cluster != null) {
+      cluster.shutdown();
+      cluster = null;
+    }
+  }
+
   @Test
   public void testDataNodeXFrameOptionsEnabled() throws Exception {
     boolean xFrameEnabled = true;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("X-FRAME-OPTIONS is absent in the header",
@@ -54,7 +66,7 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testNameNodeXFrameOptionsDisabled() throws Exception {
     boolean xFrameEnabled = false;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("unexpected X-FRAME-OPTION in header", xfoHeader == null);
@@ -63,25 +75,25 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testDataNodeXFramewithInvalidOptions() throws Exception {
     exception.expect(IllegalArgumentException.class);
-    createCluster(false, "Hadoop");
+    cluster = createCluster(false, "Hadoop");
   }
 
-  private MiniDFSCluster createCluster(boolean enabled, String
+  private static MiniDFSCluster createCluster(boolean enabled, String
       value) throws IOException {
     Configuration conf = new HdfsConfiguration();
     conf.setBoolean(DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED, enabled);
     if (value != null) {
       conf.set(DFSConfigKeys.DFS_XFRAME_OPTION_VALUE, value);
     }
-    MiniDFSCluster cluster =
+    MiniDFSCluster dfsCluster =
         new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
-    cluster.waitActive();
-    return cluster;
+    dfsCluster.waitActive();
+    return dfsCluster;
   }
 
-  private HttpURLConnection getConn(MiniDFSCluster cluster)
+  private static HttpURLConnection getConn(MiniDFSCluster dfsCluster)
       throws IOException {
-    DataNode datanode = cluster.getDataNodes().get(0);
+    DataNode datanode = dfsCluster.getDataNodes().get(0);
     URL newURL = new URL("http://localhost:" + datanode.getInfoPort());
     HttpURLConnection conn = (HttpURLConnection) newURL.openConnection();
     conn.connect();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[2/4] hadoop git commit: HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

Posted by in...@apache.org.
HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

(cherry picked from commit 26f1e22fc9ee326e9c76503d347552faeb6c2d3b)


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

Branch: refs/heads/branch-3.1
Commit: e5ff9f3922b6cd5729d8a8852d689fedb28ded90
Parents: 0460201
Author: Inigo Goiri <in...@apache.org>
Authored: Thu May 17 13:35:09 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Thu May 17 13:35:40 2018 -0700

----------------------------------------------------------------------
 .../datanode/web/TestDatanodeHttpXFrame.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e5ff9f39/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
index 9ecd8ea..62827a2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.http.HttpServer2;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -36,13 +37,24 @@ import java.net.URL;
  * Test that X-Frame-Options works correctly with DatanodeHTTPServer.
  */
 public class TestDatanodeHttpXFrame {
+
+  private MiniDFSCluster cluster = null;
+
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
+  @After
+  public void cleanUp() {
+    if (cluster != null) {
+      cluster.shutdown();
+      cluster = null;
+    }
+  }
+
   @Test
   public void testDataNodeXFrameOptionsEnabled() throws Exception {
     boolean xFrameEnabled = true;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("X-FRAME-OPTIONS is absent in the header",
@@ -54,7 +66,7 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testNameNodeXFrameOptionsDisabled() throws Exception {
     boolean xFrameEnabled = false;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("unexpected X-FRAME-OPTION in header", xfoHeader == null);
@@ -63,25 +75,25 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testDataNodeXFramewithInvalidOptions() throws Exception {
     exception.expect(IllegalArgumentException.class);
-    createCluster(false, "Hadoop");
+    cluster = createCluster(false, "Hadoop");
   }
 
-  private MiniDFSCluster createCluster(boolean enabled, String
+  private static MiniDFSCluster createCluster(boolean enabled, String
       value) throws IOException {
     Configuration conf = new HdfsConfiguration();
     conf.setBoolean(DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED, enabled);
     if (value != null) {
       conf.set(DFSConfigKeys.DFS_XFRAME_OPTION_VALUE, value);
     }
-    MiniDFSCluster cluster =
+    MiniDFSCluster dfsCluster =
         new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
-    cluster.waitActive();
-    return cluster;
+    dfsCluster.waitActive();
+    return dfsCluster;
   }
 
-  private HttpURLConnection getConn(MiniDFSCluster cluster)
+  private static HttpURLConnection getConn(MiniDFSCluster dfsCluster)
       throws IOException {
-    DataNode datanode = cluster.getDataNodes().get(0);
+    DataNode datanode = dfsCluster.getDataNodes().get(0);
     URL newURL = new URL("http://localhost:" + datanode.getInfoPort());
     HttpURLConnection conn = (HttpURLConnection) newURL.openConnection();
     conn.connect();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[3/4] hadoop git commit: HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

Posted by in...@apache.org.
HDFS-13558. TestDatanodeHttpXFrame does not shut down cluster. Contributed by Anbang Hu.

(cherry picked from commit 26f1e22fc9ee326e9c76503d347552faeb6c2d3b)


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

Branch: refs/heads/branch-3.0
Commit: d3457b38e6622592bbc37920a67f0696275d998f
Parents: fb0a258
Author: Inigo Goiri <in...@apache.org>
Authored: Thu May 17 13:35:09 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Thu May 17 13:36:16 2018 -0700

----------------------------------------------------------------------
 .../datanode/web/TestDatanodeHttpXFrame.java    | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d3457b38/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
index 9ecd8ea..62827a2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/web/TestDatanodeHttpXFrame.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.HdfsConfiguration;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.http.HttpServer2;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
@@ -36,13 +37,24 @@ import java.net.URL;
  * Test that X-Frame-Options works correctly with DatanodeHTTPServer.
  */
 public class TestDatanodeHttpXFrame {
+
+  private MiniDFSCluster cluster = null;
+
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
+  @After
+  public void cleanUp() {
+    if (cluster != null) {
+      cluster.shutdown();
+      cluster = null;
+    }
+  }
+
   @Test
   public void testDataNodeXFrameOptionsEnabled() throws Exception {
     boolean xFrameEnabled = true;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("X-FRAME-OPTIONS is absent in the header",
@@ -54,7 +66,7 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testNameNodeXFrameOptionsDisabled() throws Exception {
     boolean xFrameEnabled = false;
-    MiniDFSCluster cluster = createCluster(xFrameEnabled, null);
+    cluster = createCluster(xFrameEnabled, null);
     HttpURLConnection conn = getConn(cluster);
     String xfoHeader = conn.getHeaderField("X-FRAME-OPTIONS");
     Assert.assertTrue("unexpected X-FRAME-OPTION in header", xfoHeader == null);
@@ -63,25 +75,25 @@ public class TestDatanodeHttpXFrame {
   @Test
   public void testDataNodeXFramewithInvalidOptions() throws Exception {
     exception.expect(IllegalArgumentException.class);
-    createCluster(false, "Hadoop");
+    cluster = createCluster(false, "Hadoop");
   }
 
-  private MiniDFSCluster createCluster(boolean enabled, String
+  private static MiniDFSCluster createCluster(boolean enabled, String
       value) throws IOException {
     Configuration conf = new HdfsConfiguration();
     conf.setBoolean(DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED, enabled);
     if (value != null) {
       conf.set(DFSConfigKeys.DFS_XFRAME_OPTION_VALUE, value);
     }
-    MiniDFSCluster cluster =
+    MiniDFSCluster dfsCluster =
         new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
-    cluster.waitActive();
-    return cluster;
+    dfsCluster.waitActive();
+    return dfsCluster;
   }
 
-  private HttpURLConnection getConn(MiniDFSCluster cluster)
+  private static HttpURLConnection getConn(MiniDFSCluster dfsCluster)
       throws IOException {
-    DataNode datanode = cluster.getDataNodes().get(0);
+    DataNode datanode = dfsCluster.getDataNodes().get(0);
     URL newURL = new URL("http://localhost:" + datanode.getInfoPort());
     HttpURLConnection conn = (HttpURLConnection) newURL.openConnection();
     conn.connect();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org