aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-10-28 16:27:51 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-10-30 17:25:23 +0100
commite5edc6a864721e8462df29262b62f801b78b670e (patch)
tree406bbacd6c50797cbe53569460065f54d01e7deb /config-model/src/test
parent9682d9f7c5de1b38943c3c996ac152e896a1f37b (diff)
Changes index mode or indexing script only requires reindexing
A full refeed is not necessary for these types model changes
Diffstat (limited to 'config-model/src/test')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigChangeTestUtils.java9
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidatorTest.java20
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java42
4 files changed, 42 insertions, 32 deletions
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 4fd2609eb67..c9577009393 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
@@ -37,6 +37,15 @@ public class ConfigChangeTestUtils {
return VespaRefeedAction.of(id, name, overrides, message, services, documentType, now);
}
+ public static VespaConfigChangeAction newReindexingAction(ClusterSpec.Id id, String name, ValidationOverrides overrides, String message, Instant now) {
+ return VespaReindexAction.of(id, name, overrides, message, now);
+ }
+
+ public static VespaConfigChangeAction newReindexingAction(ClusterSpec.Id id, String name, ValidationOverrides overrides, String message,
+ List<ServiceInfo> services, String documentType, Instant now) {
+ return VespaReindexAction.of(id, name, overrides, message, services, documentType, now);
+ }
+
public static List<ConfigChangeAction> normalizeServicesInActions(List<ConfigChangeAction> result) {
return result.stream()
.map(action -> ((VespaConfigChangeAction) action).modifyAction(
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 ab56178bee3..eea60150261 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
@@ -2,7 +2,7 @@
package com.yahoo.vespa.model.application.validation.change;
import com.yahoo.config.model.api.ConfigChangeAction;
-import com.yahoo.config.model.api.ConfigChangeRefeedAction;
+import com.yahoo.config.model.api.ConfigChangeReindexAction;
import com.yahoo.config.provision.Environment;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.application.validation.ValidationTester;
@@ -29,20 +29,20 @@ public class IndexingModeChangeValidatorTest {
List<ConfigChangeAction> changeActions =
tester.deploy(oldModel, getServices(AbstractSearchCluster.IndexingMode.STREAMING), Environment.prod, validationOverrides).getSecond();
- assertRefeedChange(true, // allowed=true due to validation override
+ assertReindexingChange(true, // allowed=true due to validation override
"Cluster 'default' changed indexing mode from 'indexed' to 'streaming'",
changeActions);
}
- private void assertRefeedChange(boolean allowed, String message, List<ConfigChangeAction> changeActions) {
- List<ConfigChangeAction> refeedActions = changeActions.stream()
- .filter(a -> a instanceof ConfigChangeRefeedAction)
+ private void assertReindexingChange(boolean allowed, String message, List<ConfigChangeAction> changeActions) {
+ List<ConfigChangeAction> reindexingActions = changeActions.stream()
+ .filter(a -> a instanceof ConfigChangeReindexAction)
.collect(Collectors.toList());
- assertEquals(1, refeedActions.size());
- assertEquals(allowed, refeedActions.get(0).allowed());
- assertTrue(refeedActions.get(0) instanceof ConfigChangeRefeedAction);
- assertEquals("indexing-mode-change", ((ConfigChangeRefeedAction)refeedActions.get(0)).name());
- assertEquals(message, refeedActions.get(0).getMessage());
+ assertEquals(1, reindexingActions.size());
+ assertEquals(allowed, reindexingActions.get(0).allowed());
+ assertTrue(reindexingActions.get(0) instanceof ConfigChangeReindexAction);
+ assertEquals("indexing-mode-change", ((ConfigChangeReindexAction)reindexingActions.get(0)).name());
+ assertEquals(message, reindexingActions.get(0).getMessage());
}
private static final String getServices(AbstractSearchCluster.IndexingMode indexingMode) {
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 60b17142340..710777c742a 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
@@ -10,6 +10,7 @@ import java.time.Instant;
import java.util.Arrays;
import java.util.List;
+import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newReindexingAction;
import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRestartAction;
import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRefeedAction;
@@ -51,7 +52,7 @@ public class DocumentDatabaseChangeValidatorTest {
"Field 'f1' changed: add attribute aspect"),
newRestartAction(ClusterSpec.Id.from("test"),
"Field 'f4.s1' changed: add attribute aspect"),
- newRefeedAction(ClusterSpec.Id.from("test"),
+ newReindexingAction(ClusterSpec.Id.from("test"),
"indexing-change",
ValidationOverrides.empty,
"Field 'f2' changed: add index aspect, indexing script: '{ input f2 | summary f2; }' -> " +
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 8ffd02a4381..9f418476a24 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,11 +1,11 @@
// Copyright 2017 Yahoo Holdings. 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.ValidationOverrides;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
-import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
-import com.yahoo.vespa.model.application.validation.change.VespaRefeedAction;
+import com.yahoo.vespa.model.application.validation.change.VespaReindexAction;
import org.junit.Test;
import java.time.Instant;
@@ -50,12 +50,12 @@ public class IndexingScriptChangeValidatorTest {
private static final String FIELD = "field f1 type string";
private static final String FIELD_F2 = "field f2 type string";
- private static VespaConfigChangeAction expectedAction(String changedMsg, String fromScript, String toScript) {
- return expectedAction("f1", changedMsg, fromScript, toScript);
+ private static VespaConfigChangeAction expectedReindexingAction(String changedMsg, String fromScript, String toScript) {
+ return expectedReindexingAction("f1", changedMsg, fromScript, toScript);
}
- private static VespaConfigChangeAction expectedAction(String field, String changedMsg, String fromScript, String toScript) {
- return VespaRefeedAction.of(ClusterSpec.Id.from("test"),
+ private static VespaConfigChangeAction expectedReindexingAction(String field, String changedMsg, String fromScript, String toScript) {
+ return VespaReindexAction.of(ClusterSpec.Id.from("test"),
"indexing-change",
ValidationOverrides.empty,
"Field '" + field + "' changed: " +
@@ -65,67 +65,67 @@ public class IndexingScriptChangeValidatorTest {
}
@Test
- public void requireThatAddingIndexAspectRequireRefeed() throws Exception {
+ public void requireThatAddingIndexAspectRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: summary }",
FIELD + " { indexing: index | summary }").
- assertValidation(expectedAction("add index aspect",
+ assertValidation(expectedReindexingAction("add index aspect",
"{ input f1 | summary f1; }",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1 | summary f1; }"));
}
@Test
- public void requireThatRemovingIndexAspectRequireRefeed() throws Exception {
+ public void requireThatRemovingIndexAspectRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index | summary }",
FIELD + " { indexing: summary }").
- assertValidation(expectedAction("remove index aspect",
+ assertValidation(expectedReindexingAction("remove index aspect",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1 | summary f1; }",
"{ input f1 | summary f1; }"));
}
@Test
- public void requireThatChangingStemmingRequireRefeed() throws Exception {
+ public void requireThatChangingStemmingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index }",
FIELD + " { indexing: index \n stemming: none }").
- assertValidation(expectedAction("stemming: 'best' -> 'none'",
+ assertValidation(expectedReindexingAction("stemming: 'best' -> 'none'",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
"{ input f1 | tokenize normalize | index f1; }"));
}
@Test
- public void requireThatChangingNormalizingRequireRefeed() throws Exception {
+ public void requireThatChangingNormalizingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index }",
FIELD + " { indexing: index \n normalizing: none }").
- assertValidation(expectedAction("normalizing: 'ACCENT' -> 'NONE'",
+ assertValidation(expectedReindexingAction("normalizing: 'ACCENT' -> 'NONE'",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
"{ input f1 | tokenize stem:\"BEST\" | index f1; }"));
}
@Test
- public void requireThatChangingMatchingRequireRefeed() throws Exception {
+ public void requireThatChangingMatchingRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index \n match: exact }",
FIELD + " { indexing: index \n match { gram \n gram-size: 3 } }").
- assertValidation(expectedAction("matching: 'exact' -> 'gram (size 3)', normalizing: 'LOWERCASE' -> 'CODEPOINT'",
+ assertValidation(expectedReindexingAction("matching: 'exact' -> 'gram (size 3)', normalizing: 'LOWERCASE' -> 'CODEPOINT'",
"{ input f1 | exact | index f1; }",
"{ input f1 | ngram 3 | index f1; }"));
}
@Test
- public void requireThatSettingDynamicSummaryRequireRefeed() throws Exception {
+ public void requireThatSettingDynamicSummaryRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: summary }",
FIELD + " { indexing: summary \n summary: dynamic }").
- assertValidation(expectedAction("summary field 'f1' transform: 'none' -> 'dynamicteaser'",
+ assertValidation(expectedReindexingAction("summary field 'f1' transform: 'none' -> 'dynamicteaser'",
"{ input f1 | summary f1; }",
"{ input f1 | tokenize normalize stem:\"BEST\" | summary f1; }"));
}
@Test
- public void requireThatMultipleChangesRequireRefeed() throws Exception {
+ public void requireThatMultipleChangesRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index } " + FIELD_F2 + " { indexing: index }",
FIELD + " { indexing: index \n stemming: none } " + FIELD_F2 + " { indexing: index \n normalizing: none }").
- assertValidation(Arrays.asList(expectedAction("f1", "stemming: 'best' -> 'none'",
+ assertValidation(Arrays.asList(expectedReindexingAction("f1", "stemming: 'best' -> 'none'",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
"{ input f1 | tokenize normalize | index f1; }"),
- expectedAction("f2", "normalizing: 'ACCENT' -> 'NONE'",
+ expectedReindexingAction("f2", "normalizing: 'ACCENT' -> 'NONE'",
"{ input f2 | tokenize normalize stem:\"BEST\" | index f2; }",
"{ input f2 | tokenize stem:\"BEST\" | index f2; }")));
}