You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/12/22 15:46:10 UTC

[GitHub] [hadoop] ayushtkn commented on a change in pull request #1771: YARN-10041. Create tmp socket file under /tmp for CSI tests

ayushtkn commented on a change in pull request #1771: YARN-10041. Create tmp socket file under /tmp for CSI tests
URL: https://github.com/apache/hadoop/pull/1771#discussion_r360713370
 
 

 ##########
 File path: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-csi/src/test/java/org/apache/hadoop/yarn/csi/client/TestCsiClient.java
 ##########
 @@ -36,23 +34,24 @@
  */
 public class TestCsiClient {
 
-  private static File testRoot = null;
+  private static File socketFile = null;
   private static String domainSocket = null;
   private static FakeCsiDriver driver = null;
 
   @BeforeClass
   public static void setUp() throws IOException {
-    testRoot = GenericTestUtils.getTestDir("csi-test");
-    File socketPath = new File(testRoot, "csi.sock");
-    FileUtils.forceMkdirParent(socketPath);
-    domainSocket = "unix://" + socketPath.getAbsolutePath();
+    socketFile = new File("/tmp", "yarn-csi-test.sock");
+    domainSocket = "unix://" + socketFile.getAbsolutePath();
     driver = new FakeCsiDriver(domainSocket);
   }
 
   @AfterClass
   public static void tearDown() throws IOException {
-    if (testRoot != null) {
-      FileUtils.deleteDirectory(testRoot);
+    if (socketFile != null && socketFile.exists()) {
+      if (!socketFile.delete()) {
+        String message = "Unable to delete file " + socketFile + ".";
+        throw new IOException(message);
+      }
 
 Review comment:
   This removal seems quite weird, throwing IOE and checking this much. I checked other tests, most of them do like :
       new File(socketFile).delete(); or FileUtils.delete(..), you can check TestConfiguration.java for one such reference

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org