use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.
the class SetNodeStateTest method testSetWantedStateOnNodeNotInSlobrok.
@Test
public void testSetWantedStateOnNodeNotInSlobrok() throws Exception {
// Node 2 in cluster music does not have a valid NodeInfo due to passing true to setUp
setUp(true);
restAPI.setUnitState(new SetUnitStateRequestImpl("music/distributor/2").setNewState("user", "down", "borked node"));
UnitResponse response = restAPI.getState(new StateRequest("music/distributor/2", 0));
String expected = musicClusterExpectedUserStateStringWithUninitializedNode("east.g1", "down", "down", "down", "borked node");
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 ClusterListTest method testClusterList.
@Test
public void testClusterList() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("", 0));
String expected = "{\"cluster\": {\n" + " \"books\": {\"link\": \"\\/cluster\\/v2\\/books\"},\n" + " \"music\": {\"link\": \"\\/cluster\\/v2\\/music\"}\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 NodeTest method testNodeNotSeenInSlobrok.
@Test
public void testNodeNotSeenInSlobrok() throws Exception {
setUp(true);
ContentCluster old = music.context.cluster;
music.context.cluster = new ContentCluster(old.getName(), old.getConfiguredNodes().values(), old.getDistribution(), 0, 0.0);
NodeState currentState = new NodeState(NodeType.STORAGE, State.DOWN);
currentState.setDescription("Not seen");
music.context.currentConsolidatedState.setNodeState(new Node(NodeType.STORAGE, 1), currentState);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 0));
String expected = "{\n" + " \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + " \"state\": {\n" + " \"generated\": {\n" + " \"state\": \"down\",\n" + " \"reason\": \"Not seen\"\n" + " },\n" + " \"unit\": {\n" + " \"state\": \"down\",\n" + " \"reason\": \"Node not seen in slobrok.\"\n" + " },\n" + " \"user\": {\n" + " \"state\": \"up\",\n" + " \"reason\": \"\"\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 NodeTest method testStorage.
@Test
public void testStorage() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 0));
String expected = "{\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" + " \"partition\": {\n" + " \"0\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\\/0\"},\n" + " \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\\/1\"}\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 PartitionTest method testPartition.
@Test
public void testPartition() throws Exception {
setUp(true);
UnitResponse response = restAPI.getState(new StateRequest("music/storage/1/0", 0));
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));
}
Aggregations