Search in sources :

Example 16 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method requireThatGroupNamesCanBeDuplicatedAcrossLevels.

@Test
public void requireThatGroupNamesCanBeDuplicatedAcrossLevels() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "<documents/>\n" + "  <group>\n" + "    <distribution partitions=\"*\"/>\n" + "    <group distribution-key=\"0\" name=\"bar\">\n" + "      <group distribution-key=\"0\" name=\"foo\">\n" + "        <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "      </group>\n" + "    </group>\n" + "    <group distribution-key=\"0\" name=\"foo\">\n" + "      <group distribution-key=\"0\" name=\"bar\">\n" + "        <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + "      </group>\n" + "    </group>\n" + "  </group>\n" + "</cluster>";
    // Should not throw.
    ContentClusterUtils.createCluster(xml, new MockRoot());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Example 17 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method testRootFolder.

@Test
public void testRootFolder() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "  <documents/>" + "  <group>\n" + "    <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "  </group>\n" + "</cluster>";
    ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
    StorageNode node = cluster.getStorageNodes().getChildren().get("0");
    {
        StorDevicesConfig.Builder builder = new StorDevicesConfig.Builder();
        node.getConfig(builder);
        StorDevicesConfig config = new StorDevicesConfig(builder);
        assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/storage/0"), config.root_folder());
    }
    {
        StorServerConfig.Builder builder = new StorServerConfig.Builder();
        cluster.getStorageNodes().getConfig(builder);
        node.getConfig(builder);
        StorServerConfig config = new StorServerConfig(builder);
        assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/storage/0"), config.root_folder());
    }
    {
        StorServerConfig.Builder builder = new StorServerConfig.Builder();
        cluster.getDistributorNodes().getConfig(builder);
        cluster.getDistributorNodes().getChildren().get("0").getConfig(builder);
        StorServerConfig config = new StorServerConfig(builder);
        assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/distributor/0"), config.root_folder());
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) StorDevicesConfig(com.yahoo.vespa.config.storage.StorDevicesConfig) StorServerConfig(com.yahoo.vespa.config.content.core.StorServerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 18 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method testGenericPersistenceTuning.

@Test
public void testGenericPersistenceTuning() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "<documents/>" + "<engine>\n" + "    <fail-partition-on-error>true</fail-partition-on-error>\n" + "    <revert-time>34m</revert-time>\n" + "    <recovery-time>5d</recovery-time>\n" + "</engine>" + "  <group>\n" + "    <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "  </group>\n" + "</cluster>";
    ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
    PersistenceConfig.Builder builder = new PersistenceConfig.Builder();
    cluster.getStorageNodes().getConfig(builder);
    PersistenceConfig config = new PersistenceConfig(builder);
    assertEquals(true, config.fail_partition_on_error());
    assertEquals(34 * 60, config.revert_time_period());
    assertEquals(5 * 24 * 60 * 60, config.keep_remove_time_period());
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) PersistenceConfig(com.yahoo.vespa.config.content.PersistenceConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 19 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method testCapacity.

@Test
public void testCapacity() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "  <documents/>" + "  <group>\n" + "    <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "    <node distribution-key=\"1\" hostalias=\"mockhost\" capacity=\"1.5\"/>\n" + "    <node distribution-key=\"2\" hostalias=\"mockhost\" capacity=\"2.0\"/>\n" + "  </group>\n" + "</cluster>";
    ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
    for (int i = 0; i < 3; ++i) {
        StorageNode node = cluster.getStorageNodes().getChildren().get("" + i);
        StorServerConfig.Builder builder = new StorServerConfig.Builder();
        cluster.getStorageNodes().getConfig(builder);
        node.getConfig(builder);
        StorServerConfig config = new StorServerConfig(builder);
        assertEquals(1.0 + (double) i * 0.5, config.node_capacity(), 0.001);
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) StorServerConfig(com.yahoo.vespa.config.content.core.StorServerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 20 with MockRoot

use of com.yahoo.config.model.test.MockRoot in project vespa by vespa-engine.

the class StorageClusterTest method requireThatGroupNamesMustBeUniqueAmongstSiblings.

@Test
public void requireThatGroupNamesMustBeUniqueAmongstSiblings() throws Exception {
    String xml = "<cluster id=\"storage\">\n" + "<documents/>\n" + "  <group>\n" + "    <distribution partitions=\"*\"/>\n" + "    <group distribution-key=\"0\" name=\"bar\">\n" + "      <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + "    </group>\n" + "    <group distribution-key=\"0\" name=\"bar\">\n" + "      <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + "    </group>\n" + "  </group>\n" + "</cluster>";
    try {
        ContentClusterUtils.createCluster(xml, new MockRoot());
        fail("Did not get exception with duplicate group names");
    } catch (RuntimeException e) {
        assertEquals("Cluster 'storage' has multiple groups with name 'bar' in the same subgroup. " + "Group sibling names must be unique.", e.getMessage());
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) Test(org.junit.Test)

Aggregations

MockRoot (com.yahoo.config.model.test.MockRoot)43 Test (org.junit.Test)29 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)7 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)7 DeployState (com.yahoo.config.model.deploy.DeployState)6 Host (com.yahoo.vespa.model.Host)4 HostResource (com.yahoo.vespa.model.HostResource)4 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)3 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)3 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)3 Zone (com.yahoo.config.provision.Zone)3 NodeSpec (com.yahoo.vespa.model.search.NodeSpec)3 SearchNode (com.yahoo.vespa.model.search.SearchNode)3 Before (org.junit.Before)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 NewDocumentType (com.yahoo.documentmodel.NewDocumentType)2 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)2 ContainerSearch (com.yahoo.vespa.model.container.search.ContainerSearch)2 SearchChains (com.yahoo.vespa.model.container.search.searchchain.SearchChains)2