From 2044b38d1b8cd21afb0f842715f33e3649496c8b Mon Sep 17 00:00:00 2001 From: Geir Storli Date: Mon, 9 Oct 2017 15:33:59 +0200 Subject: Fix such that adding a document type in proton doesn't require a restart. The backend already handles this. --- .../change/ConfigValueChangeValidatorTest.java | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'config-model') diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java index cbb725987eb..f9944f563c4 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java @@ -64,6 +64,14 @@ public class ConfigValueChangeValidatorTest { assertComponentsEquals(changes, "docproc/cluster.basicsearch.indexing/0", 2); } + @Test + public void requireThatDocumentTypesCanBeAddedWithoutNeedForRestart() { + List changes = getConfigChanges( + createVespaModel("", Arrays.asList("foo")), + createVespaModel("", Arrays.asList("foo", "bar"))); + assertEquals(0, changes.size()); + } + @Test public void requireThatValidatorDetectsConfigChangeFromService() { MockRoot oldRoot = createRootWithChildren(new SimpleConfigProducer("p", 0) @@ -162,6 +170,10 @@ public class ConfigValueChangeValidatorTest { } private static VespaModel createVespaModel(String configSegment) { + return createVespaModel(configSegment, Arrays.asList("music")); + } + + private static VespaModel createVespaModel(String configSegment, List docTypes) { // Note that the configSegment is here located on root. return new VespaModelCreatorWithMockPkg( null, @@ -178,9 +190,7 @@ public class ConfigValueChangeValidatorTest { " \n" + " \n" + " 1\n" + - " \n" + - " \n" + - " \n" + + createDocumentsSegment(docTypes) + "\n" + " \n" + " \n" + " \n" + @@ -191,10 +201,24 @@ public class ConfigValueChangeValidatorTest { " \n" + " \n" + "", - Collections.singletonList("search music { document music { } }") + createSearchDefinitions(docTypes) ).create(); } + private static String createDocumentsSegment(List docTypes) { + return "\n" + + docTypes.stream() + .map(type -> "") + .collect(Collectors.joining("\n")) + + ""; + } + + private static List createSearchDefinitions(List docTypes) { + return docTypes.stream() + .map(type -> "search " + type + " { document " + type + " { } }") + .collect(Collectors.toList()); + } + private static String createQrStartConfigSegment(boolean verboseGc, int heapsize) { return "\n" + " \n" + -- cgit v1.2.3