Search in sources :

Example 1 with ZookeepersConfig

use of com.yahoo.cloud.config.ZookeepersConfig in project vespa by vespa-engine.

the class ClusterControllerClusterConfigurerTest method testSimple.

@Test
public void testSimple() throws Exception {
    ClusterController controller = new ClusterController();
    StorDistributionConfig.Builder distributionConfig = new StorDistributionConfig.Builder();
    StorDistributionConfig.Group.Builder group = new StorDistributionConfig.Group.Builder();
    group.index("0").name("foo");
    StorDistributionConfig.Group.Nodes.Builder node = new StorDistributionConfig.Group.Nodes.Builder();
    node.index(0);
    group.nodes.add(node);
    distributionConfig.group.add(group);
    FleetcontrollerConfig.Builder fleetcontrollerConfig = new FleetcontrollerConfig.Builder();
    fleetcontrollerConfig.cluster_name("storage").index(0).zookeeper_server("zoo").min_node_ratio_per_group(0.123);
    SlobroksConfig.Builder slobroksConfig = new SlobroksConfig.Builder();
    SlobroksConfig.Slobrok.Builder slobrok = new SlobroksConfig.Slobrok.Builder();
    slobrok.connectionspec("foo");
    slobroksConfig.slobrok.add(slobrok);
    ZookeepersConfig.Builder zookeepersConfig = new ZookeepersConfig.Builder();
    zookeepersConfig.zookeeperserverlist("foo");
    Metric metric = new Metric() {

        @Override
        public void set(String s, Number number, Context context) {
        }

        @Override
        public void add(String s, Number number, Context context) {
        }

        @Override
        public Context createContext(Map<String, ?> stringMap) {
            return null;
        }
    };
    // Used in standalone modus to get config without a cluster controller instance
    ClusterControllerClusterConfigurer configurer = new ClusterControllerClusterConfigurer(null, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
    assertTrue(configurer.getOptions() != null);
    assertEquals(0.123, configurer.getOptions().minNodeRatioPerGroup, 0.01);
    // Oki with no zookeeper if one node
    zookeepersConfig.zookeeperserverlist("");
    new ClusterControllerClusterConfigurer(controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
    try {
        fleetcontrollerConfig.fleet_controller_count(5);
        new ClusterControllerClusterConfigurer(controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
        fail("Should not get here");
    } catch (Exception e) {
        assertEquals("Must set zookeeper server with multiple fleetcontrollers", e.getMessage());
    }
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) ZookeepersConfig(com.yahoo.cloud.config.ZookeepersConfig) Metric(com.yahoo.jdisc.Metric) FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig) Map(java.util.Map) Test(org.junit.Test)

Example 2 with ZookeepersConfig

use of com.yahoo.cloud.config.ZookeepersConfig in project vespa by vespa-engine.

the class ClusterControllerTestCase method assertZookeepersConfig.

private void assertZookeepersConfig(TestRoot root) {
    ZookeepersConfig.Builder builder = new ZookeepersConfig.Builder();
    root.getConfig(builder, "admin/standalone");
    ZookeepersConfig config = new ZookeepersConfig(builder);
    assertThat(config.zookeeperserverlist().split(",").length, is(3));
}
Also used : ZookeepersConfig(com.yahoo.cloud.config.ZookeepersConfig)

Example 3 with ZookeepersConfig

use of com.yahoo.cloud.config.ZookeepersConfig in project vespa by vespa-engine.

the class VespaModelTestCase method testCommonConfig.

// Verify that common config from plugins is delivered from the root node for any configId, using the Builder based API
@Test
public void testCommonConfig() throws Exception {
    VespaModel model = getVespaModel(TESTDIR + "app_nohosts/");
    LogdConfig.Builder b = new LogdConfig.Builder();
    b = (LogdConfig.Builder) model.getConfig(b, "");
    LogdConfig c = new LogdConfig(b);
    assertEquals(HostName.getLocalhost(), c.logserver().host());
    SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
    sb = (com.yahoo.cloud.config.SlobroksConfig.Builder) model.getConfig(sb, "");
    SlobroksConfig sbc = new SlobroksConfig(sb);
    assertEquals(sbc.slobrok().size(), 1);
    ZookeepersConfig.Builder zb = new ZookeepersConfig.Builder();
    zb = (ZookeepersConfig.Builder) model.getConfig(zb, "");
    ZookeepersConfig zc = new ZookeepersConfig(zb);
    assertEquals(zc.zookeeperserverlist().split(",").length, 2);
    assertTrue(zc.zookeeperserverlist().startsWith(HostName.getLocalhost()));
    ApplicationIdConfig.Builder appIdBuilder = new ApplicationIdConfig.Builder();
    appIdBuilder = (ApplicationIdConfig.Builder) model.getConfig(appIdBuilder, "");
    ApplicationIdConfig applicationIdConfig = new ApplicationIdConfig(appIdBuilder);
    assertEquals(ApplicationId.defaultId().tenant().value(), applicationIdConfig.tenant());
    assertEquals(ApplicationId.defaultId().application().value(), applicationIdConfig.application());
    assertEquals(ApplicationId.defaultId().instance().value(), applicationIdConfig.instance());
}
Also used : SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) ApplicationIdConfig(com.yahoo.cloud.config.ApplicationIdConfig) LogdConfig(com.yahoo.cloud.config.log.LogdConfig) VespaModel(com.yahoo.vespa.model.VespaModel) ZookeepersConfig(com.yahoo.cloud.config.ZookeepersConfig) Test(org.junit.Test)

Aggregations

ZookeepersConfig (com.yahoo.cloud.config.ZookeepersConfig)3 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)2 Test (org.junit.Test)2 ApplicationIdConfig (com.yahoo.cloud.config.ApplicationIdConfig)1 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)1 Metric (com.yahoo.jdisc.Metric)1 FleetcontrollerConfig (com.yahoo.vespa.config.content.FleetcontrollerConfig)1 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 Map (java.util.Map)1