@Test
public void testGlobThrowsExceptionForUnreadableDir() throws Exception {

  Path obscuredDir = new Path("foo");
  Path subDir = new Path(obscuredDir, "bar"); //so foo is non-empty
  fs.mkdirs(subDir);
  fs.setPermission(obscuredDir, new FsPermission((short)0)); //no access
  try {
    PathData.expandAsGlob("foo/*", conf);
    Assert.fail("Should throw IOException");
  } catch (IOException ioe) {
    // expected
  } finally {
    // make sure the test directory can be deleted
    fs.setPermission(obscuredDir, new FsPermission((short)0755)); //default
  }
}