Search in sources :

Example 26 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class AdminTestCase method testDisableFileDistributorForAllApps.

@Test
public void testDisableFileDistributorForAllApps() {
    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 sentinelConfig = root.getConfig(SentinelConfig.class, "hosts/" + localhost);
    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"));
}
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)

Example 27 with DeployState

use of com.yahoo.config.model.deploy.DeployState 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)

Example 28 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class VespaModelTestCase method testNoMultitenantHostExported.

@Test
public void testNoMultitenantHostExported() throws IOException, SAXException {
    ApplicationPackage applicationPackage = new MockApplicationPackage.Builder().withServices("<services version='1.0'><admin version='3.0'><nodes count='1' /></admin></services>").build();
    DeployState deployState = new DeployState.Builder().applicationPackage(applicationPackage).modelHostProvisioner(new InMemoryProvisioner(true, "host1.yahoo.com")).properties(new DeployProperties.Builder().configServerSpecs(Arrays.asList(new Configserver.Spec("cfghost", 1234, 1235, 1236))).multitenant(true).build()).build(true);
    VespaModel model = new VespaModel(new NullConfigModelRegistry(), deployState);
    AllocatedHosts info = model.allocatedHosts();
    assertEquals("Admin version 3 is ignored, and there are no other hosts to borrow for admin services", 0, info.getHosts().size());
}
Also used : AllocatedHosts(com.yahoo.config.provision.AllocatedHosts) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) DeployState(com.yahoo.config.model.deploy.DeployState) InMemoryProvisioner(com.yahoo.config.model.provision.InMemoryProvisioner) DeployProperties(com.yahoo.config.model.deploy.DeployProperties) VespaModel(com.yahoo.vespa.model.VespaModel) FilesApplicationPackage(com.yahoo.config.model.application.provider.FilesApplicationPackage) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) Test(org.junit.Test)

Example 29 with DeployState

use of com.yahoo.config.model.deploy.DeployState in project vespa by vespa-engine.

the class VespaModelCreatorWithFilePkg method create.

public VespaModel create(boolean validateApplicationWithSchema) {
    try {
        if (validateApplicationWithSchema) {
            validate();
        }
        DeployState deployState = new DeployState.Builder().applicationPackage(applicationPkg).build(true);
        VespaModel model = new VespaModel(configModelRegistry, deployState);
        // Validate, but without checking configSources or routing (routing
        // is constructed in a special way and cannot always be validated in
        // this step for unit tests)
        Validation.validate(model, false, false, deployState);
        return model;
    } catch (Exception e) {
        throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
    }
}
Also used : DeployState(com.yahoo.config.model.deploy.DeployState) VespaModel(com.yahoo.vespa.model.VespaModel) IOException(java.io.IOException)

Aggregations

DeployState (com.yahoo.config.model.deploy.DeployState)29 Test (org.junit.Test)19 VespaModel (com.yahoo.vespa.model.VespaModel)14 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)10 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)9 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)7 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)7 Zone (com.yahoo.config.provision.Zone)7 MockRoot (com.yahoo.config.model.test.MockRoot)5 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 InMemoryProvisioner (com.yahoo.config.model.provision.InMemoryProvisioner)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 SentinelConfig (com.yahoo.cloud.config.SentinelConfig)2 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)2 TestDriver (com.yahoo.config.model.test.TestDriver)2 TestRoot (com.yahoo.config.model.test.TestRoot)2 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)2 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)2 Optional (java.util.Optional)2 ClusterInfoConfig (com.yahoo.cloud.config.ClusterInfoConfig)1