diff options
Diffstat (limited to 'config-model/src/test')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java | 28 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java | 7 |
2 files changed, 15 insertions, 20 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java index 469e4649c14..8e7b1a27d36 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java @@ -1,15 +1,15 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.config.model.application.provider.BaseDeployLogger; -import com.yahoo.searchdefinition.derived.TestableDeployLogger; import com.yahoo.text.XML; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import java.util.Optional; +import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -48,13 +48,16 @@ public class ClusterResourceLimitsTest { return this; } public ClusterResourceLimits build() { - var builder = new ClusterResourceLimits.Builder(enableFeedBlockInDistributor, false, new BaseDeployLogger()); + var builder = new ClusterResourceLimits.Builder(enableFeedBlockInDistributor, false); builder.setClusterControllerBuilder(ctrlBuilder); builder.setContentNodeBuilder(nodeBuilder); return builder.build(); } } + @Rule + public ExpectedException expectedException = ExpectedException.none(); + @Test public void content_node_limits_are_derived_from_cluster_controller_limits_if_not_set() { assertLimits(0.4, 0.7, 0.7, 0.85, @@ -120,13 +123,14 @@ public class ClusterResourceLimitsTest { } @Test - // TODO: Change to expect exception being thrown when no one uses this in hosted - public void default_resource_limits_when_hosted_and_warning_is_logged() { - TestableDeployLogger logger = new TestableDeployLogger(); + public void exception_is_thrown_when_resource_limits_are_specified() { final boolean hosted = true; - ClusterResourceLimits.Builder builder = new ClusterResourceLimits.Builder(true, hosted, logger); - ClusterResourceLimits limits = builder.build(new ModelElement(XML.getDocument("<cluster id=\"test\">" + + expectedException.expect(IllegalArgumentException.class); + expectedException.expectMessage(containsString("Element 'resource-limits' is not allowed to be set")); + + ClusterResourceLimits.Builder builder = new ClusterResourceLimits.Builder(true, hosted); + builder.build(new ModelElement(XML.getDocument("<cluster id=\"test\">" + " <tuning>\n" + " <resource-limits>\n" + " <memory>0.92</memory>\n" + @@ -134,12 +138,6 @@ public class ClusterResourceLimitsTest { " </tuning>\n" + "</cluster>") .getDocumentElement())); - - assertLimits(0.8, 0.8, limits.getClusterControllerLimits()); - assertLimits(0.9, 0.9, limits.getContentNodeLimits()); - - assertEquals(1, logger.warnings.size()); - assertEquals("Element resource-limits is not allowed, default limits will be used", logger.warnings.get(0)); } private void assertLimits(Double expCtrlDisk, Double expCtrlMemory, Double expNodeDisk, Double expNodeMemory, Fixture f) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java index 22e38b30959..c713414d043 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java @@ -1,12 +1,11 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import com.yahoo.config.model.application.provider.BaseDeployLogger; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.deploy.TestProperties; -import com.yahoo.vespa.config.content.FleetcontrollerConfig; import com.yahoo.config.model.test.MockRoot; import com.yahoo.text.XML; +import com.yahoo.vespa.config.content.FleetcontrollerConfig; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; import org.junit.Test; import org.w3c.dom.Document; @@ -24,9 +23,7 @@ public class FleetControllerClusterTest { var clusterElement = new ModelElement(doc.getDocumentElement()); return new ClusterControllerConfig.Builder("storage", clusterElement, - new ClusterResourceLimits.Builder(enableFeedBlockInDistributor, - false, - new BaseDeployLogger()) + new ClusterResourceLimits.Builder(enableFeedBlockInDistributor, false) .build(clusterElement).getClusterControllerLimits()) .build(root.getDeployState(), root, clusterElement.getXml()); } |