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());
}
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());
}
}
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());
}
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);
}
}
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());
}
}
Aggregations