Search in sources :

Example 6 with SentinelConfig

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

the class AdminTestCase method disableFiledistributorService.

@Test
public void disableFiledistributorService() throws Exception {
    String hosts = "<hosts>" + "  <host name=\"localhost\">" + "    <alias>node0</alias>" + "  </host>" + "</hosts>";
    String services = "<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "    <filedistribution>" + "      <disableFiledistributor>true</disableFiledistributor>" + "    </filedistribution>" + "  </admin>" + "</services>";
    VespaModel vespaModel = new VespaModelCreatorWithMockPkg(hosts, services).create();
    String localhost = HostName.getLocalhost();
    String localhostConfigId = "hosts/" + 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(3));
    assertThat(sentinelConfig.service(0).name(), is("logserver"));
    assertThat(sentinelConfig.service(1).name(), is("slobrok"));
    assertThat(sentinelConfig.service(2).name(), is("logd"));
// No filedistributor service
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 7 with SentinelConfig

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

the class AdminTestCase method testTenantAndAppInSentinelConfig.

@Test
public void testTenantAndAppInSentinelConfig() {
    DeployState state = new DeployState.Builder().zone(new Zone(Environment.dev, RegionName.from("baz"))).properties(new DeployProperties.Builder().applicationId(new ApplicationId.Builder().tenant("quux").applicationName("foo").instanceName("bim").build()).build()).build(true);
    TestRoot root = new TestDriver().buildModel(state);
    String localhost = HostName.getLocalhost();
    SentinelConfig config = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
    assertThat(config.application().tenant(), is("quux"));
    assertThat(config.application().name(), is("foo"));
    assertThat(config.application().environment(), is("dev"));
    assertThat(config.application().region(), is("baz"));
    assertThat(config.application().instance(), is("bim"));
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) SentinelConfig(com.yahoo.cloud.config.SentinelConfig) Zone(com.yahoo.config.provision.Zone) TestRoot(com.yahoo.config.model.test.TestRoot) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

Aggregations

SentinelConfig (com.yahoo.cloud.config.SentinelConfig)7 Test (org.junit.Test)7 ApplicationConfigProducerRoot (com.yahoo.config.model.ApplicationConfigProducerRoot)3 VespaModel (com.yahoo.vespa.model.VespaModel)3 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)2 DeployState (com.yahoo.config.model.deploy.DeployState)2 TestDriver (com.yahoo.config.model.test.TestDriver)2 TestRoot (com.yahoo.config.model.test.TestRoot)2 Zone (com.yahoo.config.provision.Zone)2 Slobrok (com.yahoo.cloud.config.SlobroksConfig.Slobrok)1 LogdConfig (com.yahoo.cloud.config.log.LogdConfig)1 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)1