diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/test')
16 files changed, 41 insertions, 22 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java index c170abc04ae..41003f03c0d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.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.test; import com.yahoo.config.model.ConfigModel; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiService.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiService.java index dd6ea783e79..6abc13ad86c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiService.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiService.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.test; import com.yahoo.config.model.producer.TreeConfigProducer; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/DomTestServiceBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/test/DomTestServiceBuilder.java index 6dddb9d4322..ce8f9bfcd8b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/DomTestServiceBuilder.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/DomTestServiceBuilder.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.test; import com.yahoo.config.model.deploy.DeployState; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ModelAmendingTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ModelAmendingTestCase.java index 998e19794fc..4c5f20a4e2f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ModelAmendingTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ModelAmendingTestCase.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.test; import com.yahoo.component.ComponentId; @@ -7,10 +7,13 @@ import com.yahoo.config.model.ConfigModelContext; import com.yahoo.config.model.ConfigModelRegistry; import com.yahoo.config.model.MapConfigModelRegistry; import com.yahoo.config.model.admin.AdminModel; +import com.yahoo.config.model.api.ApplicationClusterEndpoint; +import com.yahoo.config.model.api.ContainerEndpoint; import com.yahoo.config.model.builder.xml.ConfigModelBuilder; import com.yahoo.config.model.builder.xml.ConfigModelId; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.TreeConfigProducer; +import com.yahoo.config.provision.Zone; import com.yahoo.vespa.defaults.Defaults; import com.yahoo.vespa.model.AbstractService; import com.yahoo.vespa.model.HostResource; @@ -26,8 +29,11 @@ import org.w3c.dom.Element; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Set; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * Demonstrates how a model can be added at build time to amend another model. @@ -73,7 +79,9 @@ public class ModelAmendingTestCase { "</services>"; VespaModelTester tester = new VespaModelTester(amendingModelRepo); tester.addHosts(12); - VespaModel model = tester.createModel(services); + DeployState.Builder builder = new DeployState.Builder().endpoints(Set.of(new ContainerEndpoint("test1", ApplicationClusterEndpoint.Scope.zone, List.of("t1.example.com")), + new ContainerEndpoint("test2", ApplicationClusterEndpoint.Scope.zone, List.of("t2.example.com")))); + VespaModel model = tester.createModel(Zone.defaultZone(), services, true, builder); // Check that all hosts are amended for (HostResource host : model.getAdmin().hostSystem().getHosts()) { @@ -120,7 +128,9 @@ public class ModelAmendingTestCase { "</services>"; VespaModelTester tester = new VespaModelTester(amendingModelRepo); tester.addHosts(12); - VespaModel model = tester.createModel(services); + DeployState.Builder builder = new DeployState.Builder().endpoints(Set.of(new ContainerEndpoint("test1", ApplicationClusterEndpoint.Scope.zone, List.of("t1.example.com")), + new ContainerEndpoint("test2", ApplicationClusterEndpoint.Scope.zone, List.of("t2.example.com")))); + VespaModel model = tester.createModel(Zone.defaultZone(), services, true, builder); // Check that all hosts are amended for (HostResource host : model.getAdmin().hostSystem().getHosts()) { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ModelConfigProviderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ModelConfigProviderTest.java index fba51c4c027..15045b64c27 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ModelConfigProviderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ModelConfigProviderTest.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.test; import com.yahoo.cloud.config.ModelConfig; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ParentService.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ParentService.java index 1f33fe9c83e..817ad581d41 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/ParentService.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ParentService.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.test; import com.yahoo.test.StandardConfig.Builder; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/PortsMetaTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/PortsMetaTestCase.java index 0a1506fab5d..61d9d8bee2d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/PortsMetaTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/PortsMetaTestCase.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.test; import com.yahoo.vespa.model.PortsMeta; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java index a8c04f5c6ba..61bd3d885f5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.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.test; import com.yahoo.config.model.ConfigModel; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java index ac3e2e321b4..850c05545ee 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleService.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.test; import com.yahoo.test.StandardConfig.Builder; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/TestApi.java b/config-model/src/test/java/com/yahoo/vespa/model/test/TestApi.java index aedfd8df862..11cfdfa4b4c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/TestApi.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/TestApi.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.test; /** diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java index 68782b947e3..69abb10b91d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.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.test; import com.yahoo.cloud.config.ApplicationIdConfig; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java index e7d46e1c009..446a48afd20 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTester.java @@ -1,9 +1,11 @@ -// 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.test; import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.model.ConfigModelRegistry; import com.yahoo.config.model.NullConfigModelRegistry; +import com.yahoo.config.model.api.ApplicationClusterEndpoint; +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; @@ -21,12 +23,14 @@ import com.yahoo.config.provision.ProvisionLogger; import com.yahoo.config.provision.Zone; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import static com.yahoo.config.provision.NodeResources.Architecture; import static com.yahoo.vespa.model.test.utils.ApplicationPackageUtils.generateSchemas; @@ -191,7 +195,7 @@ public class VespaModelTester { * * @param services the services xml string * @param hosts the hosts xml string, or null if none - * @param useMaxResources false to use the minmal resources (when given a range), true to use max + * @param useMaxResources false to use the minimal resources (when given a range), true to use max * @param failOnOutOfCapacity whether we should get an exception when not enough hosts of the requested flavor * is available or if we should just silently receive a smaller allocation * @return the resulting model @@ -200,10 +204,11 @@ public class VespaModelTester { boolean alwaysReturnOneNode, NodeResources defaultResources, int startIndexForClusters, Optional<VespaModel> previousModel, - DeployState.Builder deployStatebuilder, String ... retiredHostNames) { + DeployState.Builder deployStateBuilder, String ... retiredHostNames) { VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(hosts, services, generateSchemas("type1")); ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg; + Set<ContainerEndpoint> containerEndpoints = deployStateBuilder.build().getEndpoints(); if (hosted) { InMemoryProvisioner provisioner = new InMemoryProvisioner(hostsByResources, failOnOutOfCapacity, @@ -215,6 +220,9 @@ public class VespaModelTester { retiredHostNames); provisioner.setEnvironment(zone.environment()); this.provisioner = new ProvisionerAdapter(provisioner); + if (containerEndpoints.isEmpty()) { + containerEndpoints = Set.of(new ContainerEndpoint("default", ApplicationClusterEndpoint.Scope.zone, List.of("default.example.com"))); + } } else { provisioner = new SingleNodeProvisioner(); } @@ -226,10 +234,11 @@ public class VespaModelTester { .setUseDedicatedNodeForLogserver(useDedicatedNodeForLogserver) .setAdminClusterNodeResourcesArchitecture(adminClusterArchitecture); - DeployState.Builder deployState = deployStatebuilder + DeployState.Builder deployState = deployStateBuilder .applicationPackage(appPkg) .modelHostProvisioner(provisioner) .properties(properties) + .endpoints(containerEndpoints) .zone(zone); previousModel.ifPresent(deployState::previousModel); return modelCreatorWithMockPkg.create(false, deployState.build(), configModelRegistry); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java index df611deb72a..1367b7a38ff 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.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.test.utils; import java.util.ArrayList; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/DeployLoggerStub.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/DeployLoggerStub.java index 482009c0e82..5f5488ede24 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/DeployLoggerStub.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/DeployLoggerStub.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.test.utils; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithFilePkg.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithFilePkg.java index 565e4c7c076..ea22d8bd717 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithFilePkg.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithFilePkg.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.test.utils; import com.yahoo.component.Version; diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java index 0ca3cb4af2e..41af1b0b2c5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/VespaModelCreatorWithMockPkg.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.test.utils; import com.yahoo.component.Version; |