]> source.dussan.org Git - sonarqube.git/commitdiff
Improve stability of RecoveryIndexerTest
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 24 Jul 2017 14:35:07 +0000 (16:35 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 25 Jul 2017 11:34:06 +0000 (13:34 +0200)
Avoid ConcurrentModificationException when reading logs from LogTester.

server/sonar-server/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java

index 01d33c8bb98d76690e7102d7b5d5dc6b12c7068f..f55a6abf8f556dc234bd80aff2d1cb2a04d0b73e 100644 (file)
@@ -85,6 +85,7 @@ public class RecoveryIndexerTest {
     underTest = newRecoveryIndexer(emptySettings.asConfig());
 
     underTest.start();
+    underTest.stop();
 
     assertThat(logTester.logs(LoggerLevel.DEBUG)).contains(
       "Elasticsearch recovery - sonar.search.recovery.delayInMs=300000",
@@ -186,6 +187,8 @@ public class RecoveryIndexerTest {
       Thread.sleep(1L);
     }
 
+    underTest.stop();
+
     // No rows treated
     assertThatQueueHasSize(1);
     assertThatLogsContain(ERROR, "Elasticsearch recovery - fail to recover documents");
@@ -207,6 +210,8 @@ public class RecoveryIndexerTest {
       Thread.sleep(1L);
     }
 
+    underTest.stop();
+
     // No rows treated
     assertThatQueueHasSize(1);
     assertThatLogsContain(INFO, "Elasticsearch recovery - 1 documents processed [1 failures]");