aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main/src/test/java/org
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2018-04-19 14:41:18 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2018-04-24 13:52:27 +0200
commit30ca0d2b4fe4f11f0b16452b516de7706b53370d (patch)
treeb349349e48388b5c02390516a7d6e27e9f8d8658 /server/sonar-main/src/test/java/org
parente518fae934aebbf5c8376d298a3f75024900cec1 (diff)
downloadsonarqube-30ca0d2b4fe4f11f0b16452b516de7706b53370d.tar.gz
sonarqube-30ca0d2b4fe4f11f0b16452b516de7706b53370d.zip
SONAR-10607 fix ability to disable Elasticsearch seccomp check
Diffstat (limited to 'server/sonar-main/src/test/java/org')
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java
index 3cc7580e2be..e38c43a3ce5 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/es/EsSettingsTest.java
@@ -54,7 +54,7 @@ public class EsSettingsTest {
private ListAppender listAppender;
@After
- public void tearDown() throws Exception {
+ public void tearDown() {
if (listAppender != null) {
ListAppender.detachMemoryAppenderToLoggerOf(EsSettings.class, listAppender);
}
@@ -82,7 +82,7 @@ public class EsSettingsTest {
}
@Test
- public void constructor_logs_warning_if_env_variable_ES_JVM_OPTIONS_is_set_and_non_empty() throws IOException {
+ public void constructor_logs_warning_if_env_variable_ES_JVM_OPTIONS_is_set_and_non_empty() {
this.listAppender = ListAppender.attachMemoryAppenderToLoggerOf(EsSettings.class);
Props props = minimalProps();
System2 system2 = mock(System2.class);
@@ -295,6 +295,23 @@ public class EsSettingsTest {
assertThat(settings.get("http.enabled")).isEqualTo("true");
}
+ @Test
+ public void enable_seccomp_filter_by_default() throws Exception {
+ Props props = minProps(CLUSTER_DISABLED);
+ Map<String, String> settings = new EsSettings(props, new EsInstallation(props), System2.INSTANCE).build();
+
+ assertThat(settings.get("bootstrap.system_call_filter")).isNull();
+ }
+
+ @Test
+ public void disable_seccomp_filter_if_configured_in_search_additional_props() throws Exception {
+ Props props = minProps(CLUSTER_DISABLED);
+ props.set("sonar.search.javaAdditionalOpts", "-Xmx1G -Dbootstrap.system_call_filter=false -Dfoo=bar");
+ Map<String, String> settings = new EsSettings(props, new EsInstallation(props), System2.INSTANCE).build();
+
+ assertThat(settings.get("bootstrap.system_call_filter")).isEqualTo("false");
+ }
+
private Props minProps(boolean cluster) throws IOException {
File homeDir = temp.newFolder();
Props props = new Props(new Properties());