diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/application/validation/change')
22 files changed, 89 insertions, 81 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CertificateRemovalChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CertificateRemovalChangeValidatorTest.java index d8dfe204453..6b7df8871aa 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CertificateRemovalChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/CertificateRemovalChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationOverrides; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigChangeTestUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigChangeTestUtils.java index 64eb63e8a56..081e10ecea6 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigChangeTestUtils.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigChangeTestUtils.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java index 37a49d439be..a41b538d3ca 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.model.deploy.DeployState; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContainerRestartValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContainerRestartValidatorTest.java index d7697792d16..ac59ca58cb5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContainerRestartValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContainerRestartValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.model.api.ConfigChangeAction; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentClusterRemovalValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentClusterRemovalValidatorTest.java index 65dfce8ff6c..362e74bb2e9 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentClusterRemovalValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentClusterRemovalValidatorTest.java @@ -1,18 +1,14 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; -import com.yahoo.collections.Pair; import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.application.api.ValidationOverrides; -import com.yahoo.config.model.api.ConfigChangeAction; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.application.validation.ValidationTester; import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; -import java.util.List; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -25,9 +21,9 @@ public class ContentClusterRemovalValidatorTest { @Test void testContentRemovalValidation() { - VespaModel previous = tester.deploy(null, getServices("contentClusterId"), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, getServices("contentClusterId"), Environment.prod, null, "contentClusterId.indexing").getFirst(); try { - tester.deploy(previous, getServices("newContentClusterId"), Environment.prod, null); + tester.deploy(previous, getServices("newContentClusterId"), Environment.prod, null, "newContentClusterId.indexing"); fail("Expected exception due to content cluster id change"); } catch (IllegalArgumentException expected) { @@ -39,8 +35,8 @@ public class ContentClusterRemovalValidatorTest { @Test void testOverridingContentRemovalValidation() { - VespaModel previous = tester.deploy(null, getServices("contentClusterId"), Environment.prod, null).getFirst(); - var result = tester.deploy(previous, getServices("newContentClusterId"), Environment.prod, removalOverride); // Allowed due to override + VespaModel previous = tester.deploy(null, getServices("contentClusterId"), Environment.prod, null, "contentClusterId.indexing").getFirst(); + var result = tester.deploy(previous, getServices("newContentClusterId"), Environment.prod, removalOverride, "newContentClusterId.indexing"); // Allowed due to override assertEquals(result.getFirst().getContainerClusters().values().stream() .flatMap(cluster -> cluster.getContainers().stream()) .map(container -> container.getServiceInfo()) diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java index 16a257b08e3..7b374870ed2 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ContentTypeRemovalValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; @@ -24,9 +24,9 @@ public class ContentTypeRemovalValidatorTest { void testContentTypeRemovalValidation() { ValidationTester tester = new ValidationTester(); - VespaModel previous = tester.deploy(null, getServices("music"), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, getServices("music"), Environment.prod, null, "test.indexing").getFirst(); try { - tester.deploy(previous, getServices("book"), Environment.prod, null); + tester.deploy(previous, getServices("book"), Environment.prod, null, "test.indexing"); fail("Expected exception due to removal of schema 'music"); } catch (IllegalArgumentException expected) { @@ -41,8 +41,8 @@ public class ContentTypeRemovalValidatorTest { void testOverridingContentTypeRemovalValidation() { ValidationTester tester = new ValidationTester(); - VespaModel previous = tester.deploy(null, getServices("music"), Environment.prod, null).getFirst(); - tester.deploy(previous, getServices("book"), Environment.prod, removalOverride); // Allowed due to override + VespaModel previous = tester.deploy(null, getServices("music"), Environment.prod, null, "test.indexing").getFirst(); + tester.deploy(previous, getServices("book"), Environment.prod, removalOverride, "test.indexing"); // Allowed due to override } private static String getServices(String documentType) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/GlobalDocumentChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/GlobalDocumentChangeValidatorTest.java index fb052e023bb..cdc80754194 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/GlobalDocumentChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/GlobalDocumentChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.provision.Environment; @@ -25,9 +25,9 @@ public class GlobalDocumentChangeValidatorTest { private void testChangeGlobalAttribute(boolean allowed, boolean oldGlobal, boolean newGlobal, String validationOverrides) { ValidationTester tester = new ValidationTester(); - VespaModel oldModel = tester.deploy(null, getServices(oldGlobal), Environment.prod, validationOverrides).getFirst(); + VespaModel oldModel = tester.deploy(null, getServices(oldGlobal), Environment.prod, validationOverrides, "default.indexing").getFirst(); try { - tester.deploy(oldModel, getServices(newGlobal), Environment.prod, validationOverrides).getSecond(); + tester.deploy(oldModel, getServices(newGlobal), Environment.prod, validationOverrides, "default.indexing").getSecond(); assertTrue(allowed); } catch (IllegalStateException e) { assertFalse(allowed); @@ -37,7 +37,8 @@ public class GlobalDocumentChangeValidatorTest { e.getMessage()); } } - private static final String getServices(boolean isGlobal) { + + private static String getServices(boolean isGlobal) { return "<services version='1.0'>" + " <content id='default' version='1.0'>" + " <redundancy>1</redundancy>" + diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSchemaClusterChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSchemaClusterChangeValidatorTest.java index 027bc706067..fb4e9f1a00b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSchemaClusterChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexedSchemaClusterChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidatorTest.java index 784174a35a0..3fd3180b37e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationOverrides.ValidationException; @@ -10,9 +10,10 @@ import com.yahoo.vespa.model.application.validation.ValidationTester; import org.junit.jupiter.api.Test; import java.util.List; -import java.util.stream.Collectors; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** * @author bratseth @@ -33,7 +34,7 @@ public class IndexingModeChangeValidatorTest { } catch (ValidationException e) { assertEquals("indexing-mode-change:\n" + - "\tDocument type 'music' in cluster 'default' changed indexing mode from 'indexed' to 'streaming'\n" + + "\tDocument type 'music' in cluster 'default-content' changed indexing mode from 'indexed' to 'streaming'\n" + "To allow this add <allow until='yyyy-mm-dd'>indexing-mode-change</allow> to validation-overrides.xml, see https://docs.vespa.ai/en/reference/validation-overrides.html", e.getMessage()); } @@ -49,7 +50,7 @@ public class IndexingModeChangeValidatorTest { tester.deploy(oldModel, getServices("streaming"), Environment.prod, validationOverrides).getSecond(); assertReindexingChange( // allowed=true due to validation override - "Document type 'music' in cluster 'default' changed indexing mode from 'indexed' to 'streaming'", + "Document type 'music' in cluster 'default-content' changed indexing mode from 'indexed' to 'streaming'", changeActions); } @@ -63,7 +64,7 @@ public class IndexingModeChangeValidatorTest { tester.deploy(oldModel, getServices("store-only"), Environment.prod, validationOverrides).getSecond(); assertReindexingChange( // allowed=true due to validation override - "Document type 'music' in cluster 'default' changed indexing mode from 'indexed' to 'store-only'", + "Document type 'music' in cluster 'default-content' changed indexing mode from 'indexed' to 'store-only'", changeActions); } @@ -79,10 +80,10 @@ public class IndexingModeChangeValidatorTest { private static String getServices(String indexingMode) { return "<services version='1.0'>" + - " <container id='default-container' version='1.0'>" + + " <container id='default' version='1.0'>" + " <nodes count='1'/>" + " </container>" + - " <content id='default' version='1.0'>" + + " <content id='default-content' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents>" + " <document type='music' mode='" + indexingMode + "'/>" + diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java index 87e1d3f0479..afa36ac271e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java @@ -1,7 +1,9 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; +import com.yahoo.config.model.api.ApplicationClusterEndpoint; import com.yahoo.config.model.api.ConfigChangeAction; +import com.yahoo.config.model.api.ContainerEndpoint; import com.yahoo.config.model.api.HostProvisioner; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.deploy.TestProperties; @@ -17,8 +19,10 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; /** * @author bratseth @@ -50,7 +54,7 @@ public class NodeResourceChangeValidatorTest { ConfigChangeAction contentAction = validate(model(1, 1, 1, 1), model(1, 1, 2, 1)).get(0); assertEquals(ConfigChangeAction.Type.RESTART, contentAction.getType()); assertEquals("service 'searchnode' of type searchnode on host3", contentAction.getServices().get(0).toString()); - assertEquals(false, contentAction.ignoreForInternalRedeploy()); + assertFalse(contentAction.ignoreForInternalRedeploy()); } private List<ConfigChangeAction> validate(VespaModel current, VespaModel next) { @@ -61,6 +65,10 @@ public class NodeResourceChangeValidatorTest { var properties = new TestProperties(); properties.setHostedVespa(true); var deployState = new DeployState.Builder().properties(properties) + .endpoints(Set.of( + new ContainerEndpoint("container1", ApplicationClusterEndpoint.Scope.zone, List.of("c1.example.com")), + new ContainerEndpoint("container2", ApplicationClusterEndpoint.Scope.zone, List.of("c2.example.com")) + )) .modelHostProvisioner(new Provisioner()); return new VespaModelCreatorWithMockPkg( null, diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyChangeValidatorTest.java index 9709c975f8e..e2cd48cc72b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyChangeValidatorTest.java @@ -1,3 +1,4 @@ +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.provision.Environment; @@ -23,8 +24,8 @@ public class RedundancyChangeValidatorTest { public void testChangingRedundancyToOne() { try { var tester = new ValidationTester(6); - VespaModel previous = tester.deploy(null, getServices("test", 2), Environment.prod, null).getFirst(); - tester.deploy(previous, getServices("test", 1), Environment.prod, null); + VespaModel previous = tester.deploy(null, getServices("test", 2), Environment.prod, null, "test.indexing").getFirst(); + tester.deploy(previous, getServices("test", 1), Environment.prod, null, "test.indexing"); fail("Expected exception"); } catch (IllegalArgumentException e) { @@ -40,11 +41,11 @@ public class RedundancyChangeValidatorTest { @Test public void testChangingRedundancyToOneWithValidationOverride() { var tester = new ValidationTester(6); - VespaModel previous = tester.deploy(null, getServices("test", 2), Environment.prod, null).getFirst(); - previous = tester.deploy(previous, getServices("test", 1), Environment.prod, redundancyOverride).getFirst(); + VespaModel previous = tester.deploy(null, getServices("test", 2), Environment.prod, null, "test.indexing").getFirst(); + previous = tester.deploy(previous, getServices("test", 1), Environment.prod, redundancyOverride, "test.indexing").getFirst(); // Staying at one does not require an override - tester.deploy(previous, getServices("test", 1), Environment.prod, null); + tester.deploy(previous, getServices("test", 1), Environment.prod, null, "test.indexing"); } private static String getServices(String contentClusterId, int redundancy) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java index 544ec2b841e..c2421e32a7f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RedundancyIncreaseValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; @@ -21,9 +21,9 @@ public class RedundancyIncreaseValidatorTest { @Test void testRedundancyIncreaseValidation() { - VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null, "contentClusterId.indexing").getFirst(); try { - tester.deploy(previous, getServices(3), Environment.prod, null); + tester.deploy(previous, getServices(3), Environment.prod, null, "contentClusterId.indexing"); fail("Expected exception due to redundancy increase"); } catch (IllegalArgumentException expected) { @@ -37,8 +37,8 @@ public class RedundancyIncreaseValidatorTest { @Test void testOverridingContentRemovalValidation() { - VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null).getFirst(); - tester.deploy(previous, getServices(3), Environment.prod, redundancyIncreaseOverride); // Allowed due to override + VespaModel previous = tester.deploy(null, getServices(2), Environment.prod, null, "contentClusterId.indexing").getFirst(); + tester.deploy(previous, getServices(3), Environment.prod, redundancyIncreaseOverride, "contentClusterId.indexing"); // Allowed due to override } private static String getServices(int redundancy) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ResourcesReductionValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ResourcesReductionValidatorTest.java index 4c185e9dfb8..f9c0d00ac2c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ResourcesReductionValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ResourcesReductionValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; @@ -20,6 +20,8 @@ import static org.junit.jupiter.api.Assertions.fail; */ public class ResourcesReductionValidatorTest { + private static final String CONTAINER_CLUSTER = "default.indexing"; + private final NodeResources hostResources = new NodeResources(64, 128, 1000, 10); private final InMemoryProvisioner provisioner = new InMemoryProvisioner(30, hostResources, true, InMemoryProvisioner.defaultHostResources); private final InMemoryProvisioner provisionerSelfHosted = new InMemoryProvisioner(30, hostResources, true, NodeResources.unspecified()); @@ -30,9 +32,9 @@ public class ResourcesReductionValidatorTest { void fail_when_reduction_by_over_50_percent() { var fromResources = new NodeResources(8, 64, 800, 1); var toResources = new NodeResources(8, 16, 800, 1); - VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); try { - tester.deploy(previous, contentServices(6, toResources), Environment.prod, null); + tester.deploy(previous, contentServices(6, toResources), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); } catch (IllegalArgumentException expected) { assertResourceReductionException(expected, @@ -45,9 +47,9 @@ public class ResourcesReductionValidatorTest { void fail_when_reducing_multiple_resources_by_over_50_percent() { var fromResources = new NodeResources(8, 64, 800, 1); var toResources = new NodeResources(3, 16, 200, 1); - VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); try { - tester.deploy(previous, contentServices(6, toResources), Environment.prod, null); + tester.deploy(previous, contentServices(6, toResources), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); } catch (IllegalArgumentException expected) { assertResourceReductionException(expected, @@ -58,20 +60,20 @@ public class ResourcesReductionValidatorTest { @Test void small_resource_decrease_is_allowed() { - VespaModel previous = tester.deploy(null, contentServices(6, new NodeResources(1.5, 64, 800, 1)), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(6, new NodeResources(.5, 48, 600, 1)), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(6, new NodeResources(1.5, 64, 800, 1)), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(6, new NodeResources(.5, 48, 600, 1)), Environment.prod, null, CONTAINER_CLUSTER); } @Test void reorganizing_resources_is_allowed() { - VespaModel previous = tester.deploy(null, contentServices(12, new NodeResources(2, 10, 100, 1)), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(4, new NodeResources(6, 30, 300, 1)), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(12, new NodeResources(2, 10, 100, 1)), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(4, new NodeResources(6, 30, 300, 1)), Environment.prod, null, CONTAINER_CLUSTER); } @Test void overriding_resource_decrease() { - VespaModel previous = tester.deploy(null, contentServices(6, new NodeResources(8, 64, 800, 1)), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(6, new NodeResources(8, 16, 800, 1)), Environment.prod, resourcesReductionOverride); // Allowed due to override + VespaModel previous = tester.deploy(null, contentServices(6, new NodeResources(8, 64, 800, 1)), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(6, new NodeResources(8, 16, 800, 1)), Environment.prod, resourcesReductionOverride, CONTAINER_CLUSTER); // Allowed due to override } @Test @@ -108,23 +110,22 @@ public class ResourcesReductionValidatorTest { void reduction_is_detected_when_going_from_unspecified_resources_content() { NodeResources toResources = defaultResources.withDiskGb(defaultResources.diskGb() / 5); try { - VespaModel previous = tester.deploy(null, contentServices(6, null), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(6, toResources), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(6, null), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(6, toResources), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); + } catch (IllegalArgumentException expected) { + assertResourceReductionException(expected, + defaultResources.multipliedBy(6), + toResources.multipliedBy(6)); } - catch (IllegalArgumentException expected) { - assertResourceReductionException(expected, - defaultResources.multipliedBy(6), - toResources.multipliedBy(6)); - } } @Test void reduction_is_detected_when_going_to_unspecified_resources_content() { NodeResources fromResources = defaultResources.withVcpu(defaultResources.vcpu() * 3); try { - VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(6, null), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(6, fromResources), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(6, null), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); } catch (IllegalArgumentException expected) { @@ -140,8 +141,8 @@ public class ResourcesReductionValidatorTest { int toNodes = 14; try { ValidationTester tester = new ValidationTester(33); - VespaModel previous = tester.deploy(null, contentServices(fromNodes, null), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(toNodes, null), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(fromNodes, null), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(toNodes, null), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); } catch (IllegalArgumentException expected) { @@ -156,9 +157,9 @@ public class ResourcesReductionValidatorTest { void testSizeReductionValidationSelfhosted() { var tester = new ValidationTester(provisionerSelfHosted); - VespaModel previous = tester.deploy(null, contentServices(10, null), Environment.prod, null).getFirst(); + VespaModel previous = tester.deploy(null, contentServices(10, null), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); try { - tester.deploy(previous, contentServices(4, null), Environment.prod, null); + tester.deploy(previous, contentServices(4, null), Environment.prod, null, CONTAINER_CLUSTER); fail("Expected exception due to resources reduction"); } catch (IllegalArgumentException expected) { @@ -174,16 +175,16 @@ public class ResourcesReductionValidatorTest { void testSizeReductionValidationMinimalDecreaseIsAllowed() { ValidationTester tester = new ValidationTester(30); - VespaModel previous = tester.deploy(null, contentServices(3, null), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(2, null), Environment.prod, null); + VespaModel previous = tester.deploy(null, contentServices(3, null), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(2, null), Environment.prod, null, CONTAINER_CLUSTER); } @Test void testOverridingSizeReductionValidation() { ValidationTester tester = new ValidationTester(33); - VespaModel previous = tester.deploy(null, contentServices(30, null), Environment.prod, null).getFirst(); - tester.deploy(previous, contentServices(14, null), Environment.prod, resourcesReductionOverride); // Allowed due to override + VespaModel previous = tester.deploy(null, contentServices(30, null), Environment.prod, null, CONTAINER_CLUSTER).getFirst(); + tester.deploy(previous, contentServices(14, null), Environment.prod, resourcesReductionOverride, CONTAINER_CLUSTER); // Allowed due to override } private void assertResourceReductionException(Exception e, NodeResources currentResources, NodeResources newResources) { @@ -235,4 +236,4 @@ public class ResourcesReductionValidatorTest { "<validation-overrides>\n" + " <allow until='2000-01-03'>resources-reduction</allow>\n" + "</validation-overrides>\n"; -}
\ No newline at end of file +} diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java index b5c73dc2971..35681095144 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.model.provision.InMemoryProvisioner; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java index fe9b1910720..e4b9b45489d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.model.api.ConfigChangeAction; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java index 5c5c86e3f3d..8db9d39534d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java index adecbf42884..f3d8eedf90b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java index eae7f4f7b41..e531087ebd6 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.documentmodel.NewDocumentType; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java index 689643e550d..684bd619ba1 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java index 639ca820613..44743c4fa3e 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java index 09385f528fb..0c2a26d9c1d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.config.application.api.ValidationId; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java index e8d075c2de3..691e4bf6744 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java @@ -1,4 +1,4 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.application.validation.change.search; import com.yahoo.config.provision.ClusterSpec; |