cnauroth commented on code in PR #4237:
URL: https://github.com/apache/hadoop/pull/4237#discussion_r932699216
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobSubmissionFiles.java:
##########
@@ -139,4 +141,19 @@ public void
testGetStagingDirWhenShortFileOwnerNameAndShortUserName()
assertEquals(stagingPath,
JobSubmissionFiles.getStagingDir(cluster, conf, user));
}
+
+ @Test
+ public void testDirPermission() throws Exception {
+ Cluster cluster = mock(Cluster.class);
+ HdfsConfiguration CONF = new HdfsConfiguration();
+ MiniDFSCluster cluster1 = new
MiniDFSCluster.Builder(CONF).numDataNodes(2).build();
+ FileSystem fs = cluster1.getFileSystem();
+ UserGroupInformation user = UserGroupInformation
+ .createUserForTesting(USER_1_SHORT_NAME, GROUP_NAMES);
+ Path stagingPath = new Path(fs.getUri().toString() +
"/testDirPermission");
+
+ when(cluster.getStagingAreaDir()).thenReturn(stagingPath);
+ Path res = JobSubmissionFiles.getStagingDir(cluster, CONF, user);
+ assertEquals(new
FsPermission(0700),fs.getFileStatus(res).getPermission());
Review Comment:
Nitpick: please add a single space after the comma.
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobSubmissionFiles.java:
##########
@@ -139,4 +141,19 @@ public void
testGetStagingDirWhenShortFileOwnerNameAndShortUserName()
assertEquals(stagingPath,
JobSubmissionFiles.getStagingDir(cluster, conf, user));
}
+
+ @Test
+ public void testDirPermission() throws Exception {
+ Cluster cluster = mock(Cluster.class);
+ HdfsConfiguration CONF = new HdfsConfiguration();
+ MiniDFSCluster cluster1 = new
MiniDFSCluster.Builder(CONF).numDataNodes(2).build();
Review Comment:
Suggestion: different variable name for greater clarity, e.g. `dfsCluster`.
Also, please use a `finally` block to guarantee calling
`MiniDFSCluster#shutdown()` at the end of the test.
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobSubmissionFiles.java:
##########
@@ -139,4 +141,19 @@ public void
testGetStagingDirWhenShortFileOwnerNameAndShortUserName()
assertEquals(stagingPath,
JobSubmissionFiles.getStagingDir(cluster, conf, user));
}
+
+ @Test
+ public void testDirPermission() throws Exception {
Review Comment:
Does this test actually cover the bug? Should the test be configuring umask
to 700 to simulate the bug more accurately?
Ideally, this should be a test that 1) fails before applying the
`JobSubmissionFiles` patch, and 2) starts passing after applying the
`JobSubmissionFiles` patch.
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapreduce/TestJobSubmissionFiles.java:
##########
@@ -139,4 +141,19 @@ public void
testGetStagingDirWhenShortFileOwnerNameAndShortUserName()
assertEquals(stagingPath,
JobSubmissionFiles.getStagingDir(cluster, conf, user));
}
+
+ @Test
+ public void testDirPermission() throws Exception {
+ Cluster cluster = mock(Cluster.class);
+ HdfsConfiguration CONF = new HdfsConfiguration();
Review Comment:
Nitpick: lower-case `conf` for local variables.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]