yandrey321 commented on code in PR #10997:
URL: https://github.com/apache/ozone/pull/10997#discussion_r4007711389


##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/http/TestHttpServer2.java:
##########
@@ -50,4 +54,25 @@ public void testIdleTimeout() throws Exception {
       assertEquals(60000, server.getIdleTimeout());
     }
   }
+
+  /**
+   * When ozone.http.basedir is not set, the base dir must be created under the
+   * system temporary directory (java.io.tmpdir), not the process working
+   * directory, so startup does not fail when the CWD is not writable.
+   */
+  @Test
+  public void testSetHttpBaseDirUsesSystemTempDir() throws Exception {
+    OzoneConfiguration conf = new OzoneConfiguration();
+    conf.unset(OzoneConfigKeys.OZONE_HTTP_BASEDIR);
+
+    HttpServer2.setHttpBaseDir(conf);
+
+    String baseDir = conf.get(OzoneConfigKeys.OZONE_HTTP_BASEDIR);
+    assertThat(baseDir).isNotEmpty();
+    Path baseDirPath = Paths.get(baseDir).toAbsolutePath().normalize();
+    assertThat(baseDirPath).exists();
+    Path systemTmpDir = Paths.get(System.getProperty("java.io.tmpdir"))
+        .toAbsolutePath().normalize();
+    assertThat(baseDirPath.startsWith(systemTmpDir)).isTrue();

Review Comment:
   do we have a test that only ozone user can write to this folder?



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

Reply via email to