bipinprasad commented on a change in pull request #3309:
URL: https://github.com/apache/storm/pull/3309#discussion_r480206177



##########
File path: 
storm-server/src/test/java/org/apache/storm/utils/ServerUtilsTest.java
##########
@@ -162,6 +174,163 @@ public void testGetUserId() throws Exception {
         int uid1 = ServerUtils.getUserId(null);
         Path p = Files.createTempFile("testGetUser", ".txt");
         int uid2 = ServerUtils.getPathOwnerUid(p.toString());
+        if (!p.toFile().delete()) {
+            LOG.warn("Could not delete tempoary file {}", p);
+        }
         assertEquals("User UID " + uid1 + " is not same as file " + 
p.toString() + " owner UID of " + uid2, uid1, uid2);
     }
+
+    @Test
+    public void testIsAnyProcessPosixProcessPidDirAlive() throws IOException {
+        final String testName = "testIsAnyProcessPosixProcessPidDirAlive";
+        List<String> errors = new ArrayList<>();
+        int maxPidCnt = 5;
+        if (ServerUtils.IS_ON_WINDOWS) {
+            LOG.info("{}: test cannot be run on Windows. Marked as 
successful", testName);
+            return;
+        }
+        final Path parentDir = Paths.get("/proc");
+        if (!parentDir.toFile().exists()) {
+            LOG.info("{}: test cannot be run on system without process 
directory {}, os.name={}",
+                    testName, parentDir, System.getProperty("os.name"));
+            {
+                // check if we can get process id on this Posix system - 
testing test code, useful on Mac

Review comment:
       Rest of test will not get exercised on Mac (no /proc dir), but at least 
the getPidOfPosixProcess() will be validated locally.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to