aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-09-18 10:48:23 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-26 23:49:37 +0200
commitd7df6d3c31db2ca875d8dec2c0b873cc04b7738e (patch)
treebde89f8ddd10e4fba79a7f0094617cbdbbad8304 /tests
parentdf538630ea2ae47b725414257f65a8a9e28722bb (diff)
downloadsonarqube-d7df6d3c31db2ca875d8dec2c0b873cc04b7738e.tar.gz
sonarqube-d7df6d3c31db2ca875d8dec2c0b873cc04b7738e.zip
SONAR-9802 fail restarting attempts on cluster nodes
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test/java/org/sonarqube/tests/cluster/ClusterTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/cluster/ClusterTest.java b/tests/src/test/java/org/sonarqube/tests/cluster/ClusterTest.java
index 5bf9ac21c7b..615c077fd95 100644
--- a/tests/src/test/java/org/sonarqube/tests/cluster/ClusterTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/cluster/ClusterTest.java
@@ -39,6 +39,7 @@ import org.junit.rules.TestRule;
import org.junit.rules.Timeout;
import org.sonarqube.ws.WsSystem;
import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.HttpException;
import static com.google.common.base.Preconditions.checkState;
import static org.assertj.core.api.Assertions.assertThat;
@@ -264,6 +265,25 @@ public class ClusterTest {
}
@Test
+ public void restart_action_is_not_allowed_for_cluster_nodes() throws Exception {
+ try (Cluster cluster = newCluster(2, 1)) {
+ cluster.getNodes().forEach(Node::start);
+ cluster.getAppNodes().forEach(Node::waitForStatusUp);
+
+ cluster.getAppNodes().forEach(node -> {
+ try {
+ node.wsClient().system().restart();
+ fail("The restart webservice must not succeed on cluster nodes");
+ } catch (HttpException e) {
+ // all good, we expected this!
+ assertThat(e.code()).isEqualTo(400);
+ assertThat(e.content()).contains("Restart not allowed for cluster nodes");
+ }
+ });
+ }
+ }
+
+ @Test
public void health_becomes_RED_when_all_search_nodes_go_down() throws Exception {
try (Cluster cluster = newCluster(2, 1)) {
cluster.getNodes().forEach(Node::start);