MAPREDUCE-6533. testDetermineCacheVisibilities of TestClientDistributedCacheManager is broken. Contributed by Chang Li

This commit is contained in:
Jason Lowe 2015-11-11 17:26:16 +00:00
parent d90769757a
commit df68eac825
2 changed files with 23 additions and 20 deletions

View File

@ -631,6 +631,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6515. Update Application priority in AM side from AM-RM heartbeat MAPREDUCE-6515. Update Application priority in AM side from AM-RM heartbeat
(Sunil G via jlowe) (Sunil G via jlowe)
MAPREDUCE-6533. testDetermineCacheVisibilities of
TestClientDistributedCacheManager is broken (Chang Li via jlowe)
Release 2.7.3 - UNRELEASED Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -44,13 +44,17 @@ public class TestClientDistributedCacheManager {
private static final Log LOG = LogFactory.getLog( private static final Log LOG = LogFactory.getLog(
TestClientDistributedCacheManager.class); TestClientDistributedCacheManager.class);
private static final String TEST_ROOT_DIR = private static final Path TEST_ROOT_DIR = new Path(
new File(System.getProperty("test.build.data", "/tmp")).toURI() System.getProperty("test.build.data",
.toString().replace(' ', '+'); System.getProperty("java.io.tmpdir")),
TestClientDistributedCacheManager.class.getSimpleName());
private static final Path TEST_VISIBILITY_PARENT_DIR =
new Path(TEST_ROOT_DIR, "TestCacheVisibility_Parent");
private static final Path TEST_VISIBILITY_CHILD_DIR =
new Path(TEST_VISIBILITY_PARENT_DIR, "TestCacheVisibility_Child");
private static final String TEST_VISIBILITY_DIR =
new File(TEST_ROOT_DIR, "TestCacheVisibility").toURI()
.toString().replace(' ', '+');
private FileSystem fs; private FileSystem fs;
private Path firstCacheFile; private Path firstCacheFile;
private Path secondCacheFile; private Path secondCacheFile;
@ -63,7 +67,7 @@ public class TestClientDistributedCacheManager {
fs = FileSystem.get(conf); fs = FileSystem.get(conf);
firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile"); firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile"); secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
thirdCacheFile = new Path(TEST_VISIBILITY_DIR,"thirdCachefile"); thirdCacheFile = new Path(TEST_VISIBILITY_CHILD_DIR,"thirdCachefile");
createTempFile(firstCacheFile, conf); createTempFile(firstCacheFile, conf);
createTempFile(secondCacheFile, conf); createTempFile(secondCacheFile, conf);
createTempFile(thirdCacheFile, conf); createTempFile(thirdCacheFile, conf);
@ -71,14 +75,9 @@ public class TestClientDistributedCacheManager {
@After @After
public void tearDown() throws IOException { public void tearDown() throws IOException {
if (!fs.delete(firstCacheFile, false)) { if (fs.delete(TEST_ROOT_DIR, true)) {
LOG.warn("Failed to delete firstcachefile"); LOG.warn("Failed to delete test root dir and its content under "
} + TEST_ROOT_DIR);
if (!fs.delete(secondCacheFile, false)) {
LOG.warn("Failed to delete secondcachefile");
}
if (!fs.delete(thirdCacheFile, false)) {
LOG.warn("Failed to delete thirdCachefile");
} }
} }
@ -105,10 +104,11 @@ public class TestClientDistributedCacheManager {
@Test @Test
public void testDetermineCacheVisibilities() throws IOException { public void testDetermineCacheVisibilities() throws IOException {
Path workingdir = new Path(TEST_VISIBILITY_DIR); fs.setWorkingDirectory(TEST_VISIBILITY_CHILD_DIR);
fs.setWorkingDirectory(workingdir); fs.setPermission(TEST_VISIBILITY_CHILD_DIR,
fs.setPermission(workingdir, new FsPermission((short)00777)); new FsPermission((short)00777));
fs.setPermission(new Path(TEST_ROOT_DIR), new FsPermission((short)00700)); fs.setPermission(TEST_VISIBILITY_PARENT_DIR,
new FsPermission((short)00700));
Job job = Job.getInstance(conf); Job job = Job.getInstance(conf);
Path relativePath = new Path("thirdCachefile"); Path relativePath = new Path("thirdCachefile");
job.addCacheFile(relativePath.toUri()); job.addCacheFile(relativePath.toUri());