@VisibleForTesting @Nonnull static Path getHeapDumpDir() { final String envName = "MESOS_SANDBOX"; final String envVar; try { envVar = getenv.apply(envName); } catch (SecurityException e) { LOG.warn("error getting environment variable {}", envName, e); return getTmpDir(); } if (envVar == null) { return getTmpDir(); } return Paths.get(envVar); }
@Test public void dumpHeapTmpDirDefault() { final String propName = "java.io.tmpdir"; final String old = System.clearProperty(propName); if (old == null) { throw new AssertionError("we were going to be the one to kill this"); } Assert.assertEquals(Memory.getTmpDir().toString(), Memory.DEFAULT_TMP_PATH); System.setProperty(propName, old); }