[ 
https://issues.apache.org/jira/browse/HDFS-17767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17947434#comment-17947434
 ] 

ASF GitHub Bot commented on HDFS-17767:
---------------------------------------

cnauroth commented on code in PR #7566:
URL: https://github.com/apache/hadoop/pull/7566#discussion_r2061005400


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDatanodeRegistration.java:
##########
@@ -79,8 +80,12 @@ public void checkConnect(String host, int port) {
   @Test
   public void testDNSLookups() throws Exception {
     MonitorDNS sm = new MonitorDNS();
-    System.setSecurityManager(sm);
-    
+    try {
+      System.setSecurityManager(sm);
+    } catch (UnsupportedOperationException e) {
+      assumeTrue("Test is skipped because SecurityManager cannot be set (JEP 
411)", false);

Review Comment:
   I would prefer to not lose test coverage, but I don't have a good idea for a 
different way to implement this.



##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSShell.java:
##########
@@ -574,28 +575,36 @@ public void run() {
     };
 
     //use SecurityManager to pause the copying of f1 and begin copying f2
-    SecurityManager sm = System.getSecurityManager();
-    System.out.println("SecurityManager = " + sm);
-    System.setSecurityManager(new SecurityManager() {
-      private boolean firstTime = true;
+    SecurityManager sm = null;

Review Comment:
   I am a little unclear on what this part of the test is trying to achieve. 
@szetszwo , I think you introduced this all the way back in 
[HADOOP-999](https://issues.apache.org/jira/browse/HADOOP-999)! 😄 I don't want 
to lose test coverage, but I'm wondering if it's safe to remove the part of the 
code that works with `SecurityManager`.





> Skip tests that depend on custom SecurityManager when Java doesn't support it
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-17767
>                 URL: https://issues.apache.org/jira/browse/HDFS-17767
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: test
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>              Labels: pull-request-available
>
> TestDFSShell and TestDatanodeRegistration always fail because SecurityManager 
> cannot be set on recent Java versions.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to