YARN-8422. TestAMSimulator failing with NPE. Contributed by Giovanni Matteo Fumarola.

(cherry picked from commit c35481594f)
This commit is contained in:
Inigo Goiri 2018-06-12 10:59:50 -07:00
parent 6a31dc9927
commit fa9d4a7493
1 changed files with 8 additions and 5 deletions

View File

@ -48,8 +48,8 @@ public class TestAMSimulator {
private YarnConfiguration conf; private YarnConfiguration conf;
private Path metricOutputDir; private Path metricOutputDir;
private Class slsScheduler; private Class<?> slsScheduler;
private Class scheduler; private Class<?> scheduler;
@Parameterized.Parameters @Parameterized.Parameters
public static Collection<Object[]> params() { public static Collection<Object[]> params() {
@ -59,7 +59,7 @@ public class TestAMSimulator {
}); });
} }
public TestAMSimulator(Class slsScheduler, Class scheduler) { public TestAMSimulator(Class<?> slsScheduler, Class<?> scheduler) {
this.slsScheduler = slsScheduler; this.slsScheduler = slsScheduler;
this.scheduler = scheduler; this.scheduler = scheduler;
} }
@ -110,7 +110,8 @@ public class TestAMSimulator {
} }
private void createMetricOutputDir() { 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 { try {
metricOutputDir = Files.createTempDirectory(testDir, "output"); metricOutputDir = Files.createTempDirectory(testDir, "output");
} catch (IOException e) { } catch (IOException e) {
@ -148,7 +149,9 @@ public class TestAMSimulator {
@After @After
public void tearDown() { public void tearDown() {
if (rm != null) {
rm.stop(); rm.stop();
}
deleteMetricOutputDir(); deleteMetricOutputDir();
} }