diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java index e920672646f6..d77722bdd31b 100644 --- a/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java @@ -1,7 +1,10 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.schema; +import com.yahoo.config.model.deploy.DeployState; import com.yahoo.document.Document; +import com.yahoo.schema.derived.DerivedConfiguration; +import com.yahoo.schema.derived.SchemaInfo; import com.yahoo.schema.document.Stemming; import com.yahoo.schema.parser.ParseException; import com.yahoo.schema.processing.ImportedFieldsResolver; @@ -479,6 +482,25 @@ void testInheritingMultipleRankProfilesWithOverlappingConstructsIsDisallowed2() } } + @Test + void testDeriving() throws Exception { + String schema = + """ + schema test { + field my_hash type long { + indexing: input my_string | hash | attribute + } + document test { + field my_string type string { + } + } + }"""; + ApplicationBuilder builder = new ApplicationBuilder(new DeployLoggerStub()); + builder.addSchema(schema); + var application = builder.build(false); // validate=false to test config deriving without validation + new DerivedConfiguration(application.schemas().get("test"), application.rankProfileRegistry()); + } + private void assertInheritedFromParent(Schema schema, RankProfileRegistry rankProfileRegistry) { assertEquals("pf1", schema.fieldSets().userFieldSets().get("parent_set").getFieldNames().stream().findFirst().get()); assertEquals(Stemming.NONE, schema.getStemming());