diff options
author | Jon Bratseth <bratseth@vespa.ai> | 2023-05-15 11:56:15 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@vespa.ai> | 2023-05-15 11:56:15 +0200 |
commit | 9df18e3066115f6084fab9b5c04ecd303084426c (patch) | |
tree | 1c68da2bb7573fcc84a66c327872926478824143 /config-application-package/src/test/java | |
parent | 7e39f8036dbeb3722fca3a50fdc9c86129011cf0 (diff) |
Don't assume any environments are single-region
Diffstat (limited to 'config-application-package/src/test/java')
3 files changed, 83 insertions, 39 deletions
diff --git a/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java index 697d8c208d3..d4c8884db11 100644 --- a/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/application/IncludeProcessorTest.java @@ -45,6 +45,7 @@ public class IncludeProcessorTest { <adminserver hostalias="node1"/> </admin> <content id="foo" version="1.0"> + <thread count="128" deploy:region="us-central us-east"/> <redundancy>1</redundancy> <documents> <document mode="index" type="music.sd"/> diff --git a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java index ca074ef9704..4d972d15716 100644 --- a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java @@ -287,38 +287,6 @@ public class OverrideProcessorTest { assertOverride(Environment.from("test"), RegionName.from("us-west"), expected); } - @Test - public void testParsingInheritEnvironment() throws TransformerException { - String expected = - "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + - "<services xmlns:deploy=\"vespa\" xmlns:preprocess=\"?\" version=\"1.0\">" + - " <admin version=\"2.0\">" + - " <adminserver hostalias=\"node0\"/>" + - " </admin>" + - " <content id=\"foo\" version=\"1.0\">" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document mode='index' type='music'/>\n" + - " <document mode='index' type='music2'/>\n" + - " <document type='music2' mode='index' />\n" + - " </documents>" + - " <nodes>" + - // node1 is specified for us-west but does not match because region overrides implies environment=prod - " <node distribution-key=\"0\" hostalias=\"node0\"/>" + - " </nodes>" + - " </content>" + - " <container id=\"stateless\" version=\"1.0\">" + - " <search/>" + - " <component id=\"foo\" class=\"MyFoo\" bundle=\"foobundle\" />" + - " <component id=\"bar\" class=\"TestBar\" bundle=\"foobundle\" />" + - " <nodes>" + - " <node hostalias=\"node0\"/>" + - " </nodes>" + - " </container>" + - "</services>"; - assertOverride(Environment.from("staging"), RegionName.from("us-west"), expected); - } - @Test(expected = IllegalArgumentException.class) public void testParsingDifferentEnvInParentAndChild() throws TransformerException { String in = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + diff --git a/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java index 49dbacbae3d..bbccc8343a1 100644 --- a/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/application/XmlPreprocessorTest.java @@ -57,14 +57,14 @@ public class XmlPreprocessorTest { Tags.empty()).run()); // Difference from dev: node1 - // Difference from dev: no TestBar + // Difference from dev: no TestBar String expectedStaging = """ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0"> <admin version="2.0"> - <adminserver hostalias="node1"/> + <adminserver hostalias="node0"/> </admin> <content id="foo" version="1.0"> <redundancy>1</redundancy> @@ -91,7 +91,81 @@ public class XmlPreprocessorTest { RegionName.defaultName(), Tags.empty()).run()); - String expectedUsWest = + String expectedPerfUsWest = + """ + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> + <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0"> + <admin version="2.0"> + <adminserver hostalias="node0"/> + </admin> + <content id="foo" version="1.0"> + <redundancy>1</redundancy> + <documents> + <document mode="index" type="music.sd"/> + </documents> + <nodes> + <node distribution-key="0" hostalias="node0"/> + </nodes> + </content> + <container id="stateless" version="1.0"> + <search/> + <component bundle="foobundle" class="MyFoo" id="foo"/> + <nodes> + <node hostalias="node0" baseport="5000"/> + </nodes> + </container> + </services>"""; + TestBase.assertDocument(expectedPerfUsWest, + new XmlPreProcessor(appDir, + services, + InstanceName.defaultName(), + Environment.perf, + RegionName.from("us-west"), + Tags.empty()).run()); + + String expectedPerfUsEastAndCentral = + """ + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> + <services xmlns:deploy="vespa" xmlns:preprocess="properties" version="1.0"> + <admin version="2.0"> + <adminserver hostalias="node0"/> + </admin> + <content id="foo" version="1.0"> + <thread count="128"/> + <redundancy>1</redundancy> + <documents> + <document mode="index" type="music.sd"/> + </documents> + <nodes> + <node distribution-key="0" hostalias="node0"/> + </nodes> + </content> + <container id="stateless" version="1.0"> + <search/> + <component bundle="foobundle" class="MyFoo" id="foo"/> + <nodes> + <node hostalias="node0" baseport="5000"/> + </nodes> + </container> + </services>"""; + TestBase.assertDocument(expectedPerfUsEastAndCentral, + new XmlPreProcessor(appDir, + services, + InstanceName.defaultName(), + Environment.perf, + RegionName.from("us-east"), + Tags.empty()).run()); + TestBase.assertDocument(expectedPerfUsEastAndCentral, + new XmlPreProcessor(appDir, + services, + InstanceName.defaultName(), + Environment.perf, + RegionName.from("us-central"), + Tags.empty()).run()); + + String expectedProdUsWest = """ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> @@ -125,7 +199,7 @@ public class XmlPreprocessorTest { </nodes> </container> </services>"""; - TestBase.assertDocument(expectedUsWest, + TestBase.assertDocument(expectedProdUsWest, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), @@ -133,7 +207,7 @@ public class XmlPreprocessorTest { RegionName.from("us-west"), Tags.empty()).run()); - String expectedUsEastAndCentral = + String expectedProdUsEastAndCentral = """ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> @@ -142,6 +216,7 @@ public class XmlPreprocessorTest { <adminserver hostalias="node1"/> </admin> <content id="foo" version="1.0"> + <thread count="128"/> <redundancy>1</redundancy> <documents> <document mode="index" type="music.sd"/> @@ -166,14 +241,14 @@ public class XmlPreprocessorTest { </nodes> </container> </services>"""; - TestBase.assertDocument(expectedUsEastAndCentral, + TestBase.assertDocument(expectedProdUsEastAndCentral, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), Environment.prod, RegionName.from("us-east"), Tags.empty()).run()); - TestBase.assertDocument(expectedUsEastAndCentral, + TestBase.assertDocument(expectedProdUsEastAndCentral, new XmlPreProcessor(appDir, services, InstanceName.defaultName(), |