diff options
author | Geir Storli <geirstorli@yahoo.no> | 2017-10-09 16:24:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 16:24:21 +0200 |
commit | 1e5ff1a1a8890085e3cb34d055e538011f56ee54 (patch) | |
tree | af0ed4e80f0ffc1bacb92797a7da7ff21b2d9047 /config-model | |
parent | 9f31611891a8dfef8086f6184e042ec04363e340 (diff) | |
parent | 2044b38d1b8cd21afb0f842715f33e3649496c8b (diff) |
Merge pull request #3688 from vespa-engine/geirst/adding-a-doc-type-doesnt-require-restart
Fix such that adding a document type in proton doesn't require a rest…
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/ConfigValueChangeValidatorTest.java | 32 |
1 files changed, 28 insertions, 4 deletions
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 @@ -65,6 +65,14 @@ public class ConfigValueChangeValidatorTest { } @Test + public void requireThatDocumentTypesCanBeAddedWithoutNeedForRestart() { + List<ConfigChangeAction> 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) .withChildren(new ServiceWithAnnotation("s1", 1), new ServiceWithAnnotation("s2", 2))); @@ -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<String> docTypes) { // Note that the configSegment is here located on root. return new VespaModelCreatorWithMockPkg( null, @@ -178,9 +190,7 @@ public class ConfigValueChangeValidatorTest { " </jdisc>\n" + " <content id='basicsearch' version='1.0'>\n" + " <redundancy>1</redundancy>\n" + - " <documents>\n" + - " <document type='music' mode='index'/>\n" + - " </documents>\n" + + createDocumentsSegment(docTypes) + "\n" + " <group>\n" + " <node hostalias='node1' distribution-key='0'/>\n" + " </group>\n" + @@ -191,10 +201,24 @@ public class ConfigValueChangeValidatorTest { " </engine>\n" + " </content>\n" + "</services>", - Collections.singletonList("search music { document music { } }") + createSearchDefinitions(docTypes) ).create(); } + private static String createDocumentsSegment(List<String> docTypes) { + return "<documents>\n" + + docTypes.stream() + .map(type -> "<document type='" + type + "' mode='index'/>") + .collect(Collectors.joining("\n")) + + "</documents>"; + } + + private static List<String> createSearchDefinitions(List<String> docTypes) { + return docTypes.stream() + .map(type -> "search " + type + " { document " + type + " { } }") + .collect(Collectors.toList()); + } + private static String createQrStartConfigSegment(boolean verboseGc, int heapsize) { return "<config name='search.config.qr-start'>\n" + " <jvm>\n" + |