[02/39] hadoop git commit: HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha)
HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/55c3e2de Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/55c3e2de Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/55c3e2de Branch: refs/heads/HDFS-1312 Commit: 55c3e2de3d636482ef2c51bdf88e89a34fc58b32 Parents: f4b9bcd Author: Karthik KambatlaAuthored: Thu May 26 14:24:31 2016 -0700 Committer: Karthik Kambatla Committed: Thu May 26 14:24:31 2016 -0700 -- .../sink/RollingFileSystemSinkTestBase.java | 8 +- .../sink/TestRollingFileSystemSinkWithHdfs.java | 93 2 files changed, 63 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/55c3e2de/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java -- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java index 4ac10f2..8c366db 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java @@ -221,8 +221,12 @@ public class RollingFileSystemSinkTestBase { mm1.testMetric2.incr(2); ms.publishMetricsNow(); // publish the metrics -ms.stop(); -ms.shutdown(); + +try { + ms.stop(); +} finally { + ms.shutdown(); +} return readLogFile(path, then, count); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/55c3e2de/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java index fc25ded..2a76604 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java @@ -26,6 +26,7 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; +import org.apache.hadoop.metrics2.MetricsException; import org.apache.hadoop.metrics2.MetricsSystem; import org.apache.hadoop.metrics2.sink.RollingFileSystemSinkTestBase.MyMetrics1; import org.junit.After; @@ -108,7 +109,7 @@ public class TestRollingFileSystemSinkWithHdfs public void testSilentAppend() throws Exception { String path = "hdfs://" + cluster.getNameNode().getHostAndPort() + "/tmp"; -assertExtraContents(doAppendTest(path, false, true, 1)); +assertExtraContents(doAppendTest(path, true, true, 1)); } /** @@ -158,8 +159,11 @@ public class TestRollingFileSystemSinkWithHdfs assertTrue("No exception was generated while writing metrics " + "even though HDFS was unavailable", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -180,12 +184,16 @@ public class TestRollingFileSystemSinkWithHdfs shutdownHdfs(); MockSink.errored = false; -ms.stop(); - -assertTrue("No exception was generated while stopping sink " -+ "even though HDFS was unavailable", MockSink.errored); +try { + ms.stop(); -ms.shutdown(); + assertTrue("No exception was generated while stopping sink " + + "even though HDFS was unavailable", MockSink.errored); +} catch (MetricsException ex) { + // Expected +} finally { + ms.shutdown(); +} } /** @@ -211,8 +219,11 @@ public class TestRollingFileSystemSinkWithHdfs + "while HDFS was unavailable, even though the sink is set to " + "ignore errors", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -233,13 +244,15 @@ public class TestRollingFileSystemSinkWithHdfs shutdownHdfs(); MockSink.errored = false; -ms.stop(); +try { + ms.stop(); -assertFalse("An exception was
hadoop git commit: HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha)
Repository: hadoop Updated Branches: refs/heads/branch-2 72773f8ea -> b4c8729cf HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b4c8729c Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b4c8729c Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b4c8729c Branch: refs/heads/branch-2 Commit: b4c8729cf96a927b1ac6e1ebb8b694d58c7c2efa Parents: 72773f8 Author: Karthik KambatlaAuthored: Thu May 26 14:39:07 2016 -0700 Committer: Karthik Kambatla Committed: Thu May 26 14:39:07 2016 -0700 -- .../sink/RollingFileSystemSinkTestBase.java | 8 +- .../sink/TestRollingFileSystemSinkWithHdfs.java | 83 2 files changed, 56 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b4c8729c/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java -- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java index 4ac10f2..8c366db 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java @@ -221,8 +221,12 @@ public class RollingFileSystemSinkTestBase { mm1.testMetric2.incr(2); ms.publishMetricsNow(); // publish the metrics -ms.stop(); -ms.shutdown(); + +try { + ms.stop(); +} finally { + ms.shutdown(); +} return readLogFile(path, then, count); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/b4c8729c/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java index 9c80b2d..f835b3f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java @@ -109,7 +109,7 @@ public class TestRollingFileSystemSinkWithHdfs public void testSilentAppend() throws Exception { String path = "hdfs://" + cluster.getNameNode().getHostAndPort() + "/tmp"; -assertExtraContents(doAppendTest(path, false, true, 1)); +assertExtraContents(doAppendTest(path, true, true, 1)); } /** @@ -159,8 +159,11 @@ public class TestRollingFileSystemSinkWithHdfs assertTrue("No exception was generated while writing metrics " + "even though HDFS was unavailable", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -183,13 +186,14 @@ public class TestRollingFileSystemSinkWithHdfs try { ms.stop(); + fail("No exception was generated while stopping sink " + "even though HDFS was unavailable"); } catch (MetricsException ex) { // Expected +} finally { + ms.shutdown(); } - -ms.shutdown(); } /** @@ -215,8 +219,11 @@ public class TestRollingFileSystemSinkWithHdfs + "while HDFS was unavailable, even though the sink is set to " + "ignore errors", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -237,13 +244,15 @@ public class TestRollingFileSystemSinkWithHdfs shutdownHdfs(); MockSink.errored = false; -ms.stop(); - -assertFalse("An exception was generated stopping sink " -+ "while HDFS was unavailable, even though the sink is set to " -+ "ignore errors", MockSink.errored); +try { + ms.stop(); -ms.shutdown(); + assertFalse("An exception was generated stopping sink " + + "while HDFS was unavailable, even though the sink is set to " + + "ignore errors", MockSink.errored); +} finally { + ms.shutdown(); +} } /** @@ -272,29 +281,37 @@ public class TestRollingFileSystemSinkWithHdfs int count = 0; -// Sleep until the flusher
hadoop git commit: HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha)
Repository: hadoop Updated Branches: refs/heads/trunk f4b9bcd87 -> 55c3e2de3 HDFS-10463. TestRollingFileSystemSinkWithHdfs needs some cleanup. (Daniel Templeton via kasha) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/55c3e2de Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/55c3e2de Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/55c3e2de Branch: refs/heads/trunk Commit: 55c3e2de3d636482ef2c51bdf88e89a34fc58b32 Parents: f4b9bcd Author: Karthik KambatlaAuthored: Thu May 26 14:24:31 2016 -0700 Committer: Karthik Kambatla Committed: Thu May 26 14:24:31 2016 -0700 -- .../sink/RollingFileSystemSinkTestBase.java | 8 +- .../sink/TestRollingFileSystemSinkWithHdfs.java | 93 2 files changed, 63 insertions(+), 38 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/55c3e2de/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java -- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java index 4ac10f2..8c366db 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSinkTestBase.java @@ -221,8 +221,12 @@ public class RollingFileSystemSinkTestBase { mm1.testMetric2.incr(2); ms.publishMetricsNow(); // publish the metrics -ms.stop(); -ms.shutdown(); + +try { + ms.stop(); +} finally { + ms.shutdown(); +} return readLogFile(path, then, count); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/55c3e2de/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java index fc25ded..2a76604 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/metrics2/sink/TestRollingFileSystemSinkWithHdfs.java @@ -26,6 +26,7 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; +import org.apache.hadoop.metrics2.MetricsException; import org.apache.hadoop.metrics2.MetricsSystem; import org.apache.hadoop.metrics2.sink.RollingFileSystemSinkTestBase.MyMetrics1; import org.junit.After; @@ -108,7 +109,7 @@ public class TestRollingFileSystemSinkWithHdfs public void testSilentAppend() throws Exception { String path = "hdfs://" + cluster.getNameNode().getHostAndPort() + "/tmp"; -assertExtraContents(doAppendTest(path, false, true, 1)); +assertExtraContents(doAppendTest(path, true, true, 1)); } /** @@ -158,8 +159,11 @@ public class TestRollingFileSystemSinkWithHdfs assertTrue("No exception was generated while writing metrics " + "even though HDFS was unavailable", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -180,12 +184,16 @@ public class TestRollingFileSystemSinkWithHdfs shutdownHdfs(); MockSink.errored = false; -ms.stop(); - -assertTrue("No exception was generated while stopping sink " -+ "even though HDFS was unavailable", MockSink.errored); +try { + ms.stop(); -ms.shutdown(); + assertTrue("No exception was generated while stopping sink " + + "even though HDFS was unavailable", MockSink.errored); +} catch (MetricsException ex) { + // Expected +} finally { + ms.shutdown(); +} } /** @@ -211,8 +219,11 @@ public class TestRollingFileSystemSinkWithHdfs + "while HDFS was unavailable, even though the sink is set to " + "ignore errors", MockSink.errored); -ms.stop(); -ms.shutdown(); +try { + ms.stop(); +} finally { + ms.shutdown(); +} } /** @@ -233,13 +244,15 @@ public class TestRollingFileSystemSinkWithHdfs shutdownHdfs(); MockSink.errored = false; -