summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2022-07-19 00:45:16 +0200
committergjoranv <gv@verizonmedia.com>2022-07-19 00:45:16 +0200
commit96f4c5a4d1280b1c1eeaa069e2674c8a5c380519 (patch)
treebd7f0bf601561e77c831f2e33f2f9e903b21911e
parent02150a86c5af19cfd88b64cd3b674b0e5ea4349e (diff)
Add tests for (non-)installed platform bundles.
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java2
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java41
2 files changed, 40 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index 6a9d6b63623..c1267568581 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -266,7 +266,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
* @return the removed component, or null if it was not present
*/
@SuppressWarnings("unused") // Used from other repositories
- public Component removeComponent(ComponentId componentId) {
+ public Component<?, ?> removeComponent(ComponentId componentId) {
return componentGroup.removeComponent(componentId);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
index b634356fcb6..ac6c5009852 100755
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
@@ -32,6 +32,8 @@ import com.yahoo.vespa.model.container.search.ContainerSearch;
import com.yahoo.vespa.model.container.search.searchchain.SearchChains;
import org.junit.Test;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -79,6 +81,26 @@ public class ContainerClusterTest {
}
@Test
+ public void search_and_docproc_bundles_are_not_installed_for_plain_application_clusters() {
+ ApplicationContainerCluster cluster = newContainerCluster();
+
+ var bundleBuilder = new PlatformBundlesConfig.Builder();
+ cluster.getConfig(bundleBuilder);
+ List<Path> installedBundles = bundleBuilder.build().bundlePaths().stream().map(Paths::get).toList();
+ installedBundles.forEach(bundle -> assertFalse(PlatformBundles.SEARCH_AND_DOCPROC_BUNDLES.contains(bundle)));
+ }
+
+ @Test
+ public void search_and_docproc_bundles_are_installed_for_application_clusters_with_search() {
+ ApplicationContainerCluster cluster = createContainerCluster(createRoot(false), false, null);
+
+ var bundleBuilder = new PlatformBundlesConfig.Builder();
+ cluster.getConfig(bundleBuilder);
+ List<Path> installedBundles = bundleBuilder.build().bundlePaths().stream().map(Paths::get).toList();
+ PlatformBundles.SEARCH_AND_DOCPROC_BUNDLES.forEach(bundle -> assertTrue(installedBundles.contains(bundle)));
+ }
+
+ @Test
public void requireThatWeCanGetTheZoneConfig() {
DeployState state = new DeployState.Builder().properties(new TestProperties().setHostedVespa(true))
.zone(new Zone(SystemName.cd, Environment.test, RegionName.from("some-region")))
@@ -96,6 +118,7 @@ public class ContainerClusterTest {
private ApplicationContainerCluster createContainerCluster(MockRoot root) {
return createContainerCluster(root, false, null);
}
+
private ApplicationContainerCluster createContainerCluster(MockRoot root, boolean isCombinedCluster, Integer memoryPercentage) {
ApplicationContainerCluster cluster = new ApplicationContainerCluster(root, "container0", "container1", root.getDeployState());
if (isCombinedCluster)
@@ -104,13 +127,16 @@ public class ContainerClusterTest {
cluster.setSearch(new ContainerSearch(cluster, new SearchChains(cluster, "search-chain"), new ContainerSearch.Options()));
return cluster;
}
+
private ClusterControllerContainerCluster createClusterControllerCluster(MockRoot root) {
return new ClusterControllerContainerCluster(root, "container0", "container1", root.getDeployState());
}
+
private MockRoot createRoot(boolean isHosted) {
DeployState state = new DeployState.Builder().properties(new TestProperties().setHostedVespa(isHosted)).build();
return createRoot(state);
}
+
private MockRoot createRoot(DeployState deployState) {
return new MockRoot("foo", deployState);
}
@@ -119,7 +145,7 @@ public class ContainerClusterTest {
boolean isCombinedCluster,
Integer explicitMemoryPercentage,
int expectedMemoryPercentage) {
- ContainerCluster<?> cluster = createContainerCluster(createRoot(isHosted), isCombinedCluster, explicitMemoryPercentage);
+ ApplicationContainerCluster cluster = createContainerCluster(createRoot(isHosted), isCombinedCluster, explicitMemoryPercentage);
QrStartConfig.Builder qsB = new QrStartConfig.Builder();
cluster.getConfig(qsB);
QrStartConfig qsC= new QrStartConfig(qsB);
@@ -194,6 +220,17 @@ public class ContainerClusterTest {
}
@Test
+ public void search_and_docproc_bundles_are_not_installed_for_cluster_controllers() {
+ MockRoot root = createRoot(false);
+ ClusterControllerContainerCluster cluster = createClusterControllerCluster(root);
+
+ var bundleBuilder = new PlatformBundlesConfig.Builder();
+ cluster.getConfig(bundleBuilder);
+ List<Path> installedBundles = bundleBuilder.build().bundlePaths().stream().map(Paths::get).toList();
+ installedBundles.forEach(bundle -> assertFalse(PlatformBundles.SEARCH_AND_DOCPROC_BUNDLES.contains(bundle)));
+ }
+
+ @Test
public void testThatLinguisticsIsExcludedForClusterControllerCluster() {
MockRoot root = createRoot(false);
ClusterControllerContainerCluster cluster = createClusterControllerCluster(root);
@@ -235,7 +272,7 @@ public class ContainerClusterTest {
}
@Test
- public void requireThatWeCanHandleNull() {
+ public void requireThatWeCanHandleNullJvmOptions() {
MockRoot root = createRoot(false);
ApplicationContainerCluster cluster = createContainerCluster(root);
addContainer(root, cluster, "c1", "host-c1");