summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-09-08 18:04:44 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2021-09-08 18:04:44 +0200
commitf27fd66ae706abfe4d369bafe5a92272a96123c9 (patch)
treebb1d153a32990d868ce6553a80164ab926905ff7 /config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
parent490a718a6036b05dca9935ea177c1af514ed10dc (diff)
Allow inheriting any rankprofile until enforcing is enabled explicit.
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
index 8f3fbfc9de9..69789d09dc2 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java
@@ -118,8 +118,13 @@ public class RankProfileTestCase extends SchemaTestCase {
@Test
public void requireThatSidewaysInheritanceIsImpossible() throws ParseException {
+ verifySidewaysInheritance(false);
+ verifySidewaysInheritance(true);
+ }
+ private void verifySidewaysInheritance(boolean enforce) throws ParseException {
RankProfileRegistry registry = new RankProfileRegistry();
- SearchBuilder builder = new SearchBuilder(registry, setupQueryProfileTypes());
+ SearchBuilder builder = new SearchBuilder(registry, setupQueryProfileTypes(),
+ new TestProperties().enforceRankProfileInheritance(enforce));
builder.importString(joinLines(
"schema child1 {",
" document child1 {",
@@ -163,7 +168,15 @@ public class RankProfileTestCase extends SchemaTestCase {
"}"));
try {
builder.build(true);
+ if (enforce) {
+ fail("Sideways inheritance should have been enforced");
+ } else {
+ assertNotNull(builder.getSearch("child2"));
+ assertNotNull(builder.getSearch("child1"));
+ assertTrue(registry.get("child1", "child").inherits("parent"));
+ }
} catch (IllegalArgumentException e) {
+ if (!enforce) fail("Sideways inheritance should have been allowed");
assertEquals("rank-profile 'child' inherits 'parent', but it does not exist anywhere in the inheritance of search 'child1'.", e.getMessage());
}
}