Search in sources :

Example 1 with Slobrok

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

the class AdminTestCase method testAdmin20.

/**
 * Test that version 2.0 of adminconfig works as expected.
 */
@Test
public void testAdmin20() throws Exception {
    VespaModel vespaModel = getVespaModel(TESTDIR + "adminconfig20");
    // Verify that the admin plugin has been loaded (always loads routing).
    assertThat(vespaModel.configModelRepo().asMap().size(), is(2));
    ApplicationConfigProducerRoot root = vespaModel.getVespa();
    assertNotNull(root);
    // Verify configIds
    Set<String> configIds = vespaModel.getConfigIds();
    String localhost = HostName.getLocalhost();
    String localhostConfigId = "hosts/" + localhost;
    assertTrue(configIds.contains(localhostConfigId));
    assertTrue(configIds.contains("admin/logserver"));
    assertTrue(configIds.contains("admin/configservers/configserver.0"));
    assertTrue(configIds.contains("admin/slobrok.0"));
    assertTrue(configIds.contains("admin/slobrok.1"));
    assertFalse(configIds.contains("admin/slobrok.2"));
    assertTrue(configIds.contains("admin"));
    // Confirm 2 slobroks in config
    SlobroksConfig.Builder sb = new SlobroksConfig.Builder();
    vespaModel.getConfig(sb, "admin/slobrok.0");
    SlobroksConfig sc = new SlobroksConfig(sb);
    assertEquals(sc.slobrok().size(), 2);
    boolean localHostOK = false;
    for (Slobrok s : sc.slobrok()) {
        if (s.connectionspec().matches(".*" + localhost + ".*"))
            localHostOK = true;
    }
    assertTrue(localHostOK);
    LogdConfig.Builder lb = new LogdConfig.Builder();
    vespaModel.getConfig(lb, "admin/slobrok.0");
    LogdConfig lc = new LogdConfig(lb);
    assertEquals(lc.logserver().host(), localhost);
    // Verify services in the sentinel config
    SentinelConfig.Builder b = new SentinelConfig.Builder();
    vespaModel.getConfig(b, localhostConfigId);
    SentinelConfig sentinelConfig = new SentinelConfig(b);
    assertThat(sentinelConfig.service().size(), is(4));
    assertThat(sentinelConfig.service(0).name(), is("logserver"));
    assertThat(sentinelConfig.service(1).name(), is("slobrok"));
    assertThat(sentinelConfig.service(2).name(), is("slobrok2"));
    assertThat(sentinelConfig.service(3).name(), is("logd"));
}
Also used : SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) LogdConfig(com.yahoo.cloud.config.log.LogdConfig) ApplicationConfigProducerRoot(com.yahoo.config.model.ApplicationConfigProducerRoot) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Slobrok(com.yahoo.cloud.config.SlobroksConfig.Slobrok) Test(org.junit.Test)

Aggregations

SentinelConfig (com.yahoo.cloud.config.SentinelConfig)1 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)1 Slobrok (com.yahoo.cloud.config.SlobroksConfig.Slobrok)1 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)1 ApplicationConfigProducerRoot (com.yahoo.config.model.ApplicationConfigProducerRoot)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 Test (org.junit.Test)1