From 0aaf59f1624a7fb2f2efb21603fd5cfcb205e8f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 15 Nov 2016 16:58:17 +0100 Subject: [PATCH] SONAR-8341 add IT --- .../src/test/java/it/serverSystem/LogsTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/it/it-tests/src/test/java/it/serverSystem/LogsTest.java b/it/it-tests/src/test/java/it/serverSystem/LogsTest.java index 2a67c98e8a0..dc976fc78d5 100644 --- a/it/it-tests/src/test/java/it/serverSystem/LogsTest.java +++ b/it/it-tests/src/test/java/it/serverSystem/LogsTest.java @@ -23,6 +23,8 @@ import com.sonar.orchestrator.Orchestrator; import it.Category4Suite; import java.io.File; import java.io.IOException; +import java.util.List; +import org.apache.commons.io.FileUtils; import org.apache.commons.io.input.ReversedLinesFileReader; import org.junit.ClassRule; import org.junit.Test; @@ -65,6 +67,14 @@ public class LogsTest { assertThat(requestId.length()).isGreaterThanOrEqualTo(20); } + @Test + public void info_log_in_sonar_log_file_when_SQ_is_done_starting() throws IOException { + List logs = FileUtils.readLines(orchestrator.getServer().getAppLogs()); + String sqIsUpMessage = "SonarQube is up"; + assertThat(logs.stream().filter(str -> str.contains(sqIsUpMessage)).findFirst()).describedAs("message is there").isNotEmpty(); + assertThat(logs.get(logs.size() - 1)).describedAs("message is the last line of logs").contains(sqIsUpMessage); + } + private void verifyLastAccessLogLine(String login, String path, int status) throws IOException { assertThat(readLastAccessLog()).endsWith(format("\"%s\" \"GET %s HTTP/1.1\" %d", login, path, status)); } -- 2.39.5