|
32 | 32 |
|
33 | 33 | import com.google.protobuf.CodedInputStream;
|
34 | 34 | import org.apache.hadoop.conf.Configuration;
|
| 35 | +import org.apache.hadoop.fs.FileSystem; |
35 | 36 | import org.apache.hadoop.fs.Path;
|
| 37 | +import org.apache.hadoop.fs.permission.FsPermission; |
| 38 | +import org.apache.hadoop.util.Time; |
36 | 39 | import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
37 | 40 | import org.apache.hadoop.yarn.api.records.ApplicationId;
|
38 | 41 | import org.apache.hadoop.yarn.api.records.ContainerId;
|
@@ -267,6 +270,23 @@ public void testServiceSplitEvents() throws Exception {
|
267 | 270 | scanner.close();
|
268 | 271 | }
|
269 | 272 |
|
| 273 | + @Test |
| 274 | + public void testDirPermissions() throws IOException { |
| 275 | + Path basePath = new Path(tempFolder.newFolder().getAbsolutePath()); |
| 276 | + Configuration conf = new Configuration(); |
| 277 | + FileSystem fs = basePath.getFileSystem(conf); |
| 278 | + FsPermission expectedPermissions = FsPermission.createImmutable((short) 01777); |
| 279 | + |
| 280 | + // Check the directory already exists and doesn't have the expected permissions. |
| 281 | + Assert.assertTrue(fs.exists(basePath)); |
| 282 | + Assert.assertNotEquals(expectedPermissions, fs.getFileStatus(basePath).getPermission()); |
| 283 | + |
| 284 | + new DatePartitionedLogger<>(HistoryEventProto.PARSER, basePath, conf, new FixedClock(Time.now())); |
| 285 | + |
| 286 | + // Check the permissions they should be same as the expected permissions |
| 287 | + Assert.assertEquals(expectedPermissions, fs.getFileStatus(basePath).getPermission()); |
| 288 | + } |
| 289 | + |
270 | 290 | private List<DAGHistoryEvent> makeHistoryEvents(TezDAGID dagId,
|
271 | 291 | ProtoHistoryLoggingService service) {
|
272 | 292 | List<DAGHistoryEvent> historyEvents = new ArrayList<>();
|
|
0 commit comments