HDFS-2127. Add a test that ensure AccessControlExceptions contain a full path. Contributed by Stephen Chu
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1393878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c19b6b7b6
commit
2c66a9f5ae
|
@ -137,6 +137,9 @@ Trunk (Unreleased)
|
||||||
HDFS-3880. Use Builder to build RPC server in HDFS.
|
HDFS-3880. Use Builder to build RPC server in HDFS.
|
||||||
(Brandon Li vias suresh)
|
(Brandon Li vias suresh)
|
||||||
|
|
||||||
|
HDFS-2127. Add a test that ensure AccessControlExceptions contain
|
||||||
|
a full path. (Stephen Chu via eli)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class TestPermission {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFilePermision() throws Exception {
|
public void testFilePermission() throws Exception {
|
||||||
final Configuration conf = new HdfsConfiguration();
|
final Configuration conf = new HdfsConfiguration();
|
||||||
conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, true);
|
conf.setBoolean(DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY, true);
|
||||||
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
|
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
|
||||||
|
@ -244,6 +244,10 @@ public class TestPermission {
|
||||||
fs.mkdirs(p);
|
fs.mkdirs(p);
|
||||||
return true;
|
return true;
|
||||||
} catch(AccessControlException e) {
|
} catch(AccessControlException e) {
|
||||||
|
// We check that AccessControlExceptions contain absolute paths.
|
||||||
|
Path parent = p.getParent();
|
||||||
|
assertTrue(parent.isUriPathAbsolute());
|
||||||
|
assertTrue(e.getMessage().contains(parent.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,6 +257,9 @@ public class TestPermission {
|
||||||
fs.create(p);
|
fs.create(p);
|
||||||
return true;
|
return true;
|
||||||
} catch(AccessControlException e) {
|
} catch(AccessControlException e) {
|
||||||
|
Path parent = p.getParent();
|
||||||
|
assertTrue(parent.isUriPathAbsolute());
|
||||||
|
assertTrue(e.getMessage().contains(parent.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,6 +269,8 @@ public class TestPermission {
|
||||||
fs.open(p);
|
fs.open(p);
|
||||||
return true;
|
return true;
|
||||||
} catch(AccessControlException e) {
|
} catch(AccessControlException e) {
|
||||||
|
assertTrue(p.isUriPathAbsolute());
|
||||||
|
assertTrue(e.getMessage().contains(p.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,6 +281,9 @@ public class TestPermission {
|
||||||
fs.rename(src, dst);
|
fs.rename(src, dst);
|
||||||
return true;
|
return true;
|
||||||
} catch(AccessControlException e) {
|
} catch(AccessControlException e) {
|
||||||
|
Path parent = dst.getParent();
|
||||||
|
assertTrue(parent.isUriPathAbsolute());
|
||||||
|
assertTrue(e.getMessage().contains(parent.toString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue