diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-08-24 10:21:37 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2016-08-24 10:21:37 +0200 |
commit | 556f0c365d9e644d1bb8f4d37cc89458aa940f61 (patch) | |
tree | 761348396c7ac579883acbd0e64a72004e220032 /sonar-application | |
parent | 9eb83a4ee9e247c4ab8af35b8e30c2f8c220ca68 (diff) | |
parent | a79dddadd5038e9d6bbc26d363e39576180c1063 (diff) | |
download | sonarqube-556f0c365d9e644d1bb8f4d37cc89458aa940f61.tar.gz sonarqube-556f0c365d9e644d1bb8f4d37cc89458aa940f61.zip |
Merge branch 'branch-5.6'
Diffstat (limited to 'sonar-application')
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/App.java | 2 | ||||
-rw-r--r-- | sonar-application/src/test/java/org/sonar/application/AppTest.java | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java index 8109f0ed0ac..059e81c0feb 100644 --- a/sonar-application/src/main/java/org/sonar/application/App.java +++ b/sonar-application/src/main/java/org/sonar/application/App.java @@ -98,6 +98,8 @@ public class App implements Stoppable { .addJavaOptions(props.nonNullValue(ProcessProperties.WEB_JAVA_ADDITIONAL_OPTS)) // required for logback tomcat valve .setEnvVariable(ProcessProperties.PATH_LOGS, props.nonNullValue(ProcessProperties.PATH_LOGS)) + // ensure JRuby uses SQ's temp directory as temp directory (eg. for temp files used during HTTP uploads) + .setEnvVariable("TMPDIR", props.nonNullValue(ProcessProperties.PATH_TEMP)) .setClassName("org.sonar.server.app.WebServer") .setArguments(props.rawProperties()) .addClasspath("./lib/common/*") diff --git a/sonar-application/src/test/java/org/sonar/application/AppTest.java b/sonar-application/src/test/java/org/sonar/application/AppTest.java index ac2bdf272d3..b6ba402c0a3 100644 --- a/sonar-application/src/test/java/org/sonar/application/AppTest.java +++ b/sonar-application/src/test/java/org/sonar/application/AppTest.java @@ -35,6 +35,7 @@ import org.sonar.process.monitor.JavaCommand; import org.sonar.process.monitor.Monitor; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -129,6 +130,21 @@ public class AppTest { assertThat(argument.getValue().get(1).getClasspath()).contains("oracle/ojdbc6.jar"); } + @Test + public void sets_TMPDIR_env_var_of_Web_process() throws Exception { + Monitor monitor = mock(Monitor.class); + App app = new App(monitor); + Props props = initDefaultProps(); + String expectedTmpDir = "expected tmp dir"; + props.set("sonar.path.temp", expectedTmpDir); + app.start(props); + + ArgumentCaptor<List<JavaCommand>> argument = newJavaCommandArgumentCaptor(); + verify(monitor).start(argument.capture()); + + assertThat(argument.getValue().get(1).getEnvVariables()).contains(entry("TMPDIR", expectedTmpDir)); + } + private Props initDefaultProps() throws IOException { Props props = new Props(new Properties()); ProcessProperties.completeDefaults(props); |