use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class PartitionTest method testRecursiveCluster.
@Test
public void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1/0", 1));
String expected = "{\n" + " \"state\": {\"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }},\n" + " \"metrics\": {\n" + " \"bucket-count\": 1,\n" + " \"unique-document-count\": 2,\n" + " \"unique-document-total-size\": 3\n" + " }\n" + "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class ServiceTest method testRecursiveCluster.
@Test
public void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/distributor", 1));
String expected = "{\"node\": {\n" + " \"1\": {\n" + " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + " }\n" + " },\n" + " \"2\": {\n" + " \"attributes\": {\"hierarchical-group\": \"east.g1\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"down\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"down\",\n" + " \"reason\": \"Node not seen in slobrok.\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + " }\n" + " },\n" + " \"3\": {\n" + " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + " }\n" + " },\n" + " \"5\": {\n" + " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + " }\n" + " },\n" + " \"7\": {\n" + " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }\n" + " }\n" + " }\n" + "}}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class ClusterTest method testRecursiveCluster.
@Test
public void testRecursiveCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music", 1));
String expected = "{\n" + " \"state\": {\"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }},\n" + " \"service\": {\n" + " \"storage\": {\"node\": {\n" + " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\"},\n" + " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/2\"},\n" + " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/3\"},\n" + " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/5\"},\n" + " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/7\"}\n" + " }},\n" + " \"distributor\": {\"node\": {\n" + " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" + " \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" + " \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" + " \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" + " \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" + " }}\n" + " },\n" + " \"distribution-states\": {\"published\": {\n" + " \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" + " \"bucket-spaces\": []\n" + " }}\n" + "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class ClusterTest method testCluster.
@Test
public void testCluster() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("books", 0));
String expected = "{\n" + " \"state\": {\"generated\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\n" + " }},\n" + " \"service\": {\n" + " \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" + " \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" + " },\n" + " \"distribution-states\": {\"published\": {\n" + " \"baseline\": \"distributor:4 storage:4\",\n" + " \"bucket-spaces\": [\n" + " {\n" + " \"name\": \"default\",\n" + " \"state\": \"distributor:4 storage:4 .3.s:m\"\n" + " },\n" + " {\n" + " \"name\": \"global\",\n" + " \"state\": \"distributor:4 storage:4\"\n" + " }\n" + " ]\n" + " }}\n" + "}";
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class SetNodeStateTest method verifyStateSet.
private void verifyStateSet(String state, String reason) throws Exception {
restAPI.setUnitState(new SetUnitStateRequestImpl("music/distributor/1").setNewState("user", state, reason));
UnitResponse response = restAPI.getState(new StateRequest("music/distributor/1", 0));
String expected = musicClusterExpectedUserStateString("east.g2", "up", "up", state.toLowerCase(), reason);
assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Aggregations