From c35481594ffc372e3f846b0c8ebc2ff9e36ffdb0 Mon Sep 17 00:00:00 2001 From: Inigo Goiri Date: Tue, 12 Jun 2018 10:59:50 -0700 Subject: [PATCH] YARN-8422. TestAMSimulator failing with NPE. Contributed by Giovanni Matteo Fumarola. --- .../hadoop/yarn/sls/appmaster/TestAMSimulator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java index bfc7d0c6c3..bc8ea70e46 100644 --- a/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java +++ b/hadoop-tools/hadoop-sls/src/test/java/org/apache/hadoop/yarn/sls/appmaster/TestAMSimulator.java @@ -49,8 +49,8 @@ public class TestAMSimulator { private YarnConfiguration conf; private Path metricOutputDir; - private Class slsScheduler; - private Class scheduler; + private Class slsScheduler; + private Class scheduler; @Parameterized.Parameters public static Collection params() { @@ -60,7 +60,7 @@ public static Collection params() { }); } - public TestAMSimulator(Class slsScheduler, Class scheduler) { + public TestAMSimulator(Class slsScheduler, Class scheduler) { this.slsScheduler = slsScheduler; this.scheduler = scheduler; } @@ -115,7 +115,8 @@ private void verifySchedulerMetrics(String appId) { } private void createMetricOutputDir() { - Path testDir = Paths.get(System.getProperty("test.build.data")); + Path testDir = + Paths.get(System.getProperty("test.build.data", "target/test-dir")); try { metricOutputDir = Files.createTempDirectory(testDir, "output"); } catch (IOException e) { @@ -153,7 +154,9 @@ public void testAMSimulator() throws Exception { @After public void tearDown() { - rm.stop(); + if (rm != null) { + rm.stop(); + } deleteMetricOutputDir(); }