CommandCV commented on code in PR #15529:
URL: 
https://github.com/apache/dolphinscheduler/pull/15529#discussion_r1477303657


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/test/java/org/apache/dolphinscheduler/plugin/task/api/utils/ProcessUtilsTest.java:
##########
@@ -70,6 +72,7 @@ public void testGetPidsStr() throws Exception {
         String exceptPidsStr3 = "5000 6000 7000 7100";
         String command3;
         if (SystemUtils.IS_OS_MAC) {
+            pids3 = "-+= 5000 sshd -+- 6000 sshd --= 7000 bash --- 7100 
python";

Review Comment:
   I tried to test this method separately by operating system, but found that 
it did not work. The operating system field in `SystemUtils` is declared as 
`static final`, which means we can't modify it by reflection.
   ```
   public static final String OS_NAME = getSystemProperty("os.name");
   public static final boolean IS_OS_LINUX = getOsMatchesName("Linux") || 
getOsMatchesName("LINUX");
   public static final boolean IS_OS_MAC = getOsMatchesName("Mac");
   public static final boolean IS_OS_WINDOWS = 
getOsMatchesName(OS_NAME_WINDOWS_PREFIX);
   
   private static boolean getOsMatchesName(final String osNamePrefix) {
       return isOSNameMatch(OS_NAME, osNamePrefix);
   }
   
   static boolean isOSNameMatch(final String osName, final String osNamePrefix) 
{
       if (osName == null) {
           return false;
       }
       return osName.startsWith(osNamePrefix);
   }
   ```



-- 
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]

Reply via email to