summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-08-03 09:02:10 +0000
committerArne Juul <arnej@verizonmedia.com>2021-08-03 09:29:12 +0000
commit456e8bc77ec14cba2772f12e1bf309622474769e (patch)
treea5e013978a65e0138f4144ee290688a404e5944c /config-model
parentd69352923101ecfddb3d988da6f3d72d3f4c5215 (diff)
add unit test
* exact same expression with "normalize" should not trigger reindexing
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java7
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java26
2 files changed, 33 insertions, 0 deletions
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 20ff9afd530..e7270eaefa1 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
@@ -31,6 +31,13 @@ public abstract class ContentClusterFixture {
nextCluster = createCluster(nextSd);
}
+ public ContentClusterFixture(String entireSd) throws Exception {
+ currentCluster = new ContentClusterBuilder().build(
+ ContentClusterUtils.createMockRoot(Arrays.asList(entireSd)));
+ nextCluster = new ContentClusterBuilder().build(
+ ContentClusterUtils.createMockRoot(Arrays.asList(entireSd)));
+ }
+
private static ContentCluster createCluster(String sdContent) throws Exception {
return new ContentClusterBuilder().build(
ContentClusterUtils.createMockRoot(
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 b1fda081b64..18856e0731b 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
@@ -6,6 +6,9 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
import com.yahoo.vespa.model.application.validation.change.VespaReindexAction;
+
+import static com.yahoo.config.model.test.TestUtil.joinLines;
+
import org.junit.Test;
import java.util.Arrays;
@@ -25,6 +28,13 @@ public class IndexingScriptChangeValidatorTest {
nextDb().getDerivedConfiguration().getSearch());
}
+ public Fixture(String entireSd) throws Exception {
+ super(entireSd);
+ validator = new IndexingScriptChangeValidator(ClusterSpec.Id.from("test"),
+ currentDb().getDerivedConfiguration().getSearch(),
+ nextDb().getDerivedConfiguration().getSearch());
+ }
+
@Override
public List<VespaConfigChangeAction> validate() {
return validator.validate();
@@ -176,4 +186,20 @@ public class IndexingScriptChangeValidatorTest {
validate());
}
+ @Test
+ public void requireThatNormalizeIsOk() throws Exception {
+ String entireSd = joinLines(
+ "search test {",
+ " document test {",
+ " field inside type array<string> {",
+ " indexing: summary",
+ " }",
+ " }",
+ " field outside type array<string> {",
+ " indexing: input inside | for_each { normalize } | index outside",
+ " }",
+ "}");
+ new Fixture(entireSd).assertValidation();
+ }
+
}