From ad6fa8f9d5b9ba68779a2fe87faf5c71acfc0065 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Wed, 29 May 2024 09:15:50 +0200 Subject: Add test showing that inheriting a non-existent document summary gives NullPointerException Today we give a warning and plan to fix this in Vespa 9. This test shows that we might as well throw as we get a NullPointerException and config server returns and internal server error when this happens, which is worse. --- .../processing/SummaryConsistencyTestCase.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'config-model/src/test/java') diff --git a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java index 9eca2106c5e..1184e49b381 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/SummaryConsistencyTestCase.java @@ -5,6 +5,7 @@ import com.yahoo.schema.Schema; import com.yahoo.schema.ApplicationBuilder; import com.yahoo.schema.parser.ParseException; import com.yahoo.vespa.documentmodel.SummaryTransform; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static com.yahoo.config.model.test.TestUtil.joinLines; @@ -42,4 +43,26 @@ public class SummaryConsistencyTestCase { Schema schema = ApplicationBuilder.createFromString(sd).getSchema(); assertEquals(SummaryTransform.ATTRIBUTECOMBINER, schema.getSummaryField("elem_array_unfiltered").getTransform()); } + + @Test + @Disabled + void testDocumentTypesWithInheritanceOfNonExistingField() throws ParseException { + String schemaString = """ + schema foo { + document foo { + field foo type string { + indexing: summary + } + } + document-summary foo_summary inherits non-existent { + summary foo { + source: foo + } + } + } + """; + var schema = ApplicationBuilder.createFromString(schemaString).getSchema(); + schema.getSummaryField("foo_summary"); + } + } -- cgit v1.2.3