aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2024-04-28 18:28:33 +0200
committerHarald Musum <musum@yahooinc.com>2024-04-28 18:28:33 +0200
commit71a04a3277ee8c8a40f50673ec2fa8c7e88ead84 (patch)
tree59d0e2b2a30e2fdfc6ea8825ba0e30050b44eaaf /config-model/src/test/java
parent63b2a4f138914dd1b974908305dd0daa9ce4633c (diff)
Handle TokenMgrException properly when adding rank profiles outside schema
Diffstat (limited to 'config-model/src/test/java')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java b/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
index 8d2c98439ca..af6fb82ee7b 100644
--- a/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/parser/IntermediateCollectionTestCase.java
@@ -1,6 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.parser;
+import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.io.reader.NamedReader;
import static com.yahoo.config.model.test.TestUtil.joinLines;
@@ -232,5 +233,16 @@ public class IntermediateCollectionTestCase {
assertTrue(ex.getMessage().startsWith("Inheritance/reference cycle for documents: "));
}
+ @Test
+ void can_detect_errors_in_rank_profile_outside_schema() {
+ var collection = new IntermediateCollection();
+ collection.addSchemaFromFile("src/test/derived/rankprofilemodularity/test.sd");
+ var exception = assertThrows(ParseException.class, () -> {
+ collection.addRankProfileFile("test", "src/test/derived/rankprofilemodularity2/invalid_comment.profile");
+ });
+ var message = exception.getMessage();
+ assertTrue(message.contains("Failed parsing rank-profile from 'src/test/derived/rankprofilemodularity2/invalid_comment.profile'"));
+ assertTrue(message.contains("Lexical error at line 3, column 6"), message);
+ }
}