From 71a00349dbf59b7161af75b095a641084b4a8aa3 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 24 Jul 2017 16:35:07 +0200 Subject: [PATCH] Improve stability of RecoveryIndexerTest Avoid ConcurrentModificationException when reading logs from LogTester. --- .../test/java/org/sonar/server/es/RecoveryIndexerTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/sonar-server/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java index 01d33c8bb98..f55a6abf8f5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/es/RecoveryIndexerTest.java @@ -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]"); -- 2.39.5