aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
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);