use of com.yahoo.messagebus.routing.RoutingNode in project vespa by vespa-engine.
the class StoragePolicyTestEnvironment method sendToCorrectNode.
protected void sendToCorrectNode(String cluster, int correctNode) {
RoutingNode target = select();
target.handleReply(new EmptyReply());
Reply reply = frame.getReceptor().getReply(60);
assertNotNull(reply);
assertFalse(reply.hasErrors());
assertEquals(reply.getTrace().toString(), "storage/cluster." + cluster + "/distributor/" + correctNode, target.getRoute().getHop(0).toString());
}
use of com.yahoo.messagebus.routing.RoutingNode in project vespa by vespa-engine.
the class BasicTests method testVerifyBucketOneNodePreferenceInTenNodeDefaultCluster.
/**
* To be independent of changes in distribution algorithm, we programmatically calculate preferred order of
* bucket 1, which we will be using in the tests. To avoid doing this ahead of every test, we still hardcode the
* values, though only one place, and have this test to verify they are correct, and make it easy to update the values.
*/
public void testVerifyBucketOneNodePreferenceInTenNodeDefaultCluster() {
int[] result = new int[10];
setClusterNodes(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
String clusterState = " bits:16 storage:10 distributor:10";
for (int i = 0; i < 10; ++i) {
// Update cached cluster state, to reflect which node we want to find
RoutingNode target = select();
target.handleReply(new WrongDistributionReply("version:" + (i + 1) + clusterState));
Reply reply = frame.getReceptor().getReply(60);
assertNotNull(reply);
assertFalse(reply.hasErrors());
// Find correct target
target = select();
Pair<String, Integer> address = getAddress(target);
result[i] = address.getSecond();
removeNode(address.getSecond());
clusterState += " ." + result[i] + ".s:d";
}
assertEquals(Arrays.toString(bucketOneNodePreference), Arrays.toString(result));
}
Aggregations