summaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-01-08 18:11:09 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-01-13 13:42:43 +0100
commit454932613ec7810bce21d53abee0bcc98fa72d04 (patch)
tree3c22cce5f5a88ccc7c82b5d47c4e2704f2d1d1d0 /it
parent5db076096966170cde636fa2c41d7777abca193e (diff)
downloadsonarqube-454932613ec7810bce21d53abee0bcc98fa72d04.tar.gz
sonarqube-454932613ec7810bce21d53abee0bcc98fa72d04.zip
SONAR-7168 support restart in prod mode in ITs
in addition, rename IT DevModeTest to RestartTest
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/Category4Suite.java4
-rw-r--r--it/it-tests/src/test/java/it/serverSystem/RestartTest.java (renamed from it/it-tests/src/test/java/it/serverSystem/DevModeTest.java)30
2 files changed, 23 insertions, 11 deletions
diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java
index f95e3e0a94f..389a3db0314 100644
--- a/it/it-tests/src/test/java/it/Category4Suite.java
+++ b/it/it-tests/src/test/java/it/Category4Suite.java
@@ -28,7 +28,7 @@ import it.dbCleaner.PurgeTest;
import it.duplication.CrossProjectDuplicationsOnRemoveFileTest;
import it.duplication.CrossProjectDuplicationsTest;
import it.duplication.DuplicationsTest;
-import it.serverSystem.DevModeTest;
+import it.serverSystem.RestartTest;
import it.serverSystem.HttpsTest;
import it.serverSystem.ServerSystemRestartingOrchestrator;
import it.serverSystem.ServerSystemTest;
@@ -44,7 +44,7 @@ import static util.ItUtils.xooPlugin;
@RunWith(Suite.class)
@Suite.SuiteClasses({
// server system
- DevModeTest.class,
+ RestartTest.class,
HttpsTest.class,
ServerSystemTest.class,
ServerSystemRestartingOrchestrator.class,
diff --git a/it/it-tests/src/test/java/it/serverSystem/DevModeTest.java b/it/it-tests/src/test/java/it/serverSystem/RestartTest.java
index d48f269adf6..d52215d3776 100644
--- a/it/it-tests/src/test/java/it/serverSystem/DevModeTest.java
+++ b/it/it-tests/src/test/java/it/serverSystem/RestartTest.java
@@ -25,20 +25,25 @@ import org.apache.commons.lang.SystemUtils;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.DisableOnDebug;
import org.junit.rules.ExpectedException;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
/**
- * This class start a new orchestrator on each test case
+ * This class starts a new orchestrator on each test case
*/
-public class DevModeTest {
+public class RestartTest {
Orchestrator orchestrator;
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public TestRule globalTimeout = new DisableOnDebug(Timeout.seconds(120));
@After
public void stop() {
@@ -47,22 +52,29 @@ public class DevModeTest {
}
}
- /**
- * SONAR-4843
- */
@Test
- public void restart_forbidden_if_not_dev_mode() throws Exception {
+ public void restart_in_prod_mode_requires_admin_privileges_and_restarts_WebServer_and_ES() throws Exception {
// server classloader locks Jar files on Windows
if (!SystemUtils.IS_OS_WINDOWS) {
orchestrator = Orchestrator.builderEnv()
+ .setOrchestratorProperty("orchestrator.keepWorkspace", "true")
.build();
orchestrator.start();
+
try {
- orchestrator.getServer().adminWsClient().systemClient().restart();
+ orchestrator.getServer().wsClient().systemClient().restart();
fail();
} catch (Exception e) {
assertThat(e.getMessage()).contains("403");
}
+
+ orchestrator.getServer().adminWsClient().systemClient().restart();
+
+ // we just wait five seconds, for a lack of a better approach to waiting for the restart process to start in SQ
+ Thread.sleep(5000);
+
+ assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()))
+ .contains("Requesting SonarQube restart");
}
}
@@ -80,8 +92,8 @@ public class DevModeTest {
orchestrator.getServer().adminWsClient().systemClient().restart();
assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs()))
- .contains("Restart server")
- .contains("Server restarted");
+ .contains("Fast restarting WebServer...")
+ .contains("WebServer restarted");
}
}
}