Skip to content

Commit

Permalink
Test config deriving without validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bratseth committed Nov 6, 2024
1 parent ebaf7e4 commit a5cc2e2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions config-model/src/test/java/com/yahoo/schema/SchemaTestCase.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit a5cc2e2

Please sign in to comment.