use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class StateChangeHandlerTest method initialize.
private void initialize(Config config) {
Distribution distribution = new Distribution(Distribution.getDefaultDistributionConfig(2, 100));
this.config = config;
for (int i = 0; i < config.nodeCount; ++i) configuredNodes.add(new ConfiguredNode(i, false));
cluster = new ContentCluster("testcluster", configuredNodes, distribution, 0, 0.0);
nodeStateChangeHandler = new StateChangeHandler(clock, eventLog, null);
params.minStorageNodesUp(1).minDistributorNodesUp(1).minRatioOfStorageNodesUp(0.0).minRatioOfDistributorNodesUp(0.0).maxPrematureCrashes(config.maxPrematureCrashes).transitionTimes(5000).cluster(cluster);
nodeStateUpdateListener = new TestNodeStateOrHostInfoChangeHandler();
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class ClusterFixture method forHierarchicCluster.
public static ClusterFixture forHierarchicCluster(DistributionBuilder.GroupBuilder root) {
List<ConfiguredNode> nodes = DistributionBuilder.buildConfiguredNodes(root.totalNodeCount());
Distribution distribution = DistributionBuilder.forHierarchicCluster(root);
ContentCluster cluster = new ContentCluster("foo", nodes, distribution, 0, 0.0);
return new ClusterFixture(cluster, distribution);
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class ClusterFixture method forFlatCluster.
public static ClusterFixture forFlatCluster(int nodeCount) {
Collection<ConfiguredNode> nodes = DistributionBuilder.buildConfiguredNodes(nodeCount);
Distribution distribution = DistributionBuilder.forFlatCluster(nodeCount);
ContentCluster cluster = new ContentCluster("foo", nodes, distribution, 0, 0.0);
return new ClusterFixture(cluster, distribution);
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class RpcServerTest method testGetMaster.
@Test
public void testGetMaster() throws Exception {
startingTest("RpcServerTest::testGetMaster");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(2, 10)));
setUpFleetController(true, options);
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
int rpcPort = fleetController.getRpcPort();
supervisor = new Supervisor(new Transport());
Target connection = supervisor.connect(new Spec("localhost", rpcPort));
assertTrue(connection.isValid());
Request req = new Request("getMaster");
connection.invokeSync(req, timeoutS);
assertEquals(req.toString(), 0, req.returnValues().get(0).asInt32());
assertEquals(req.toString(), "All 1 nodes agree that 0 is current master.", req.returnValues().get(1).asString());
// Note that this feature is tested better in MasterElectionTest.testGetMaster as it has multiple fleetcontrollers
}
use of com.yahoo.vdslib.distribution.Distribution in project vespa by vespa-engine.
the class StatusPagesTest method testStatusThroughContainer.
@Test
public void testStatusThroughContainer() throws Exception {
startingTest("StatusPagesTest::testStatusThroughContainer()");
FleetControllerOptions options = new FleetControllerOptions("mycluster");
options.setStorageDistribution(new Distribution(Distribution.getDefaultDistributionConfig(3, 10)));
final StatusHandler.ContainerStatusPageServer statusServer = new StatusHandler.ContainerStatusPageServer();
setUpFleetController(true, options, true, statusServer);
setUpVdsNodes(true, new DummyVdsNodeOptions());
waitForStableSystem();
// ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 100, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000));
// FleetControllerComponent fcComp = new FleetControllerComponent();
// fcComp.addFleetController("mycluster", fleetController, statusServer);
StatusHandler comp = new StatusHandler(new StatusHandler.ClusterStatusPageServerSet() {
@Override
public StatusHandler.ContainerStatusPageServer get(String cluster) {
return ("mycluster".equals(cluster) ? statusServer : null);
}
@Override
public Map<String, StatusHandler.ContainerStatusPageServer> getAll() {
Map<String, StatusHandler.ContainerStatusPageServer> map = new HashMap<>();
map.put("mycluster", statusServer);
return map;
}
});
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 200, result.getHttpReturnCode());
assertEquals("<title>clusters</title>\n<a href=\"./mycluster\">mycluster</a><br>\n", result.getContent().toString());
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1/");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 200, result.getHttpReturnCode());
assertEquals("<title>clusters</title>\n<a href=\"./mycluster\">mycluster</a><br>\n", result.getContent().toString());
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1/mycluster");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 200, result.getHttpReturnCode());
assertTrue(result.toString(true), result.getContent().toString().contains("mycluster Cluster Controller 0 Status Page"));
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1/mycluster/");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 200, result.getHttpReturnCode());
assertTrue(result.toString(true), result.getContent().toString().contains("mycluster Cluster Controller 0 Status Page"));
assertTrue(result.toString(true), result.getContent().toString().contains("href=\"mycluster/node=distributor.0\""));
assertTrue(result.toString(true), result.getContent().toString().contains("href=\"mycluster/node=storage.0\""));
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1/mycluster/node=storage.0");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 200, result.getHttpReturnCode());
assertTrue(result.toString(true), result.getContent().toString().contains("Node status for storage.0"));
assertTrue(result.toString(true), result.getContent().toString().contains("href=\"..\""));
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v1/foo");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 404, result.getHttpReturnCode());
}
{
HttpRequest request = new HttpRequest().setPath("/foobar/v1/mycluster/");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 404, result.getHttpReturnCode());
}
{
HttpRequest request = new HttpRequest().setPath("/clustercontroller-status/v2/");
HttpResult result = comp.handleRequest(request);
assertEquals(result.toString(true), 404, result.getHttpReturnCode());
}
// executor.shutdown();
}
Aggregations