]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8798 reduce Elasticsearch log level to "WARN" for unit tests
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Fri, 28 Jul 2017 08:52:45 +0000 (10:52 +0200)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 9 Aug 2017 13:09:54 +0000 (15:09 +0200)
server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java
travis.sh

index addb74de18ad4ade6f67c7c6e881bd8cfba0b37d..5a0bf45b3f0f928ba5cdf34b12828f29d6b81f33 100644 (file)
@@ -44,6 +44,7 @@ import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.client.Client;
 import org.elasticsearch.cluster.ClusterState;
 import org.elasticsearch.cluster.metadata.MetaData;
+import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.network.NetworkModule;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.TimeValue;
@@ -81,6 +82,10 @@ public class EsTester extends ExternalResource {
     System.setProperty("es.log4j.shutdownEnabled", "false");
     System.setProperty("log4j2.disable.jmx", "true");
     System.setProperty("log4j.skipJansi", "true"); // jython has this crazy shaded Jansi version that log4j2 tries to load
+
+    if (!Strings.hasLength(System.getProperty("tests.es.logger.level"))) {
+      System.setProperty("tests.es.logger.level", "WARN");
+    }
   }
 
   private static final Set<String> NO_TEMPLATES_SURVIVING_WIPE = Collections.emptySet();
index 0cc60cad32cb06f40958ebc131de872f38495709..70f6b1e2cec9c3d1ff7ea45ff5b6fe79623033e1 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -119,7 +119,7 @@ BUILD)
 
   # Minimal Maven settings
   export MAVEN_OPTS="-Xmx1G -Xms128m"
-  MAVEN_ARGS="-T 1C -Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION"
+  MAVEN_ARGS="-T 1C -Dmaven.test.redirectTestOutputToFile=false -Dsurefire.useFile=false -B -e -V -DbuildVersion=$BUILD_VERSION -Dtests.es.logger.level=WARN"
 
   if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
     echo 'Build and analyze master'