diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-10-18 12:55:57 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-10-18 12:55:57 +0200 |
commit | 2779d3a18fe1bdb1cccc5d0eb88bbebf92b0cb15 (patch) | |
tree | 52edd84d255a6c6441b561a3ceaa264bb0d9fd98 /config-application-package | |
parent | ff5425a5ced4134efcf8682c04d546e89bbe770e (diff) |
Move major-version from services to deploy
Diffstat (limited to 'config-application-package')
5 files changed, 54 insertions, 0 deletions
diff --git a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java index 4bdc586116e..0f783b00438 100644 --- a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java @@ -20,6 +20,7 @@ import java.io.FileReader; import java.io.IOException; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -90,6 +91,20 @@ public class FilesApplicationPackageTest { assertTrue(deployment.exists()); FilesApplicationPackage app = FilesApplicationPackage.fromFile(appDir); assertTrue(app.getDeployment().isPresent()); + assertFalse(app.getMajorVersion().isPresent()); assertThat(IOUtils.readAll(new FileReader(deployment)), is(IOUtils.readAll(app.getDeployment().get()))); } + + @Test + public void testPinningMajorVersion() throws IOException { + File appDir = new File("src/test/resources/app-pinning-major-version"); + final File deployment = new File(appDir, "deployment.xml"); + assertTrue(deployment.exists()); + FilesApplicationPackage app = FilesApplicationPackage.fromFile(appDir); + assertTrue(app.getDeployment().isPresent()); + assertTrue(app.getMajorVersion().isPresent()); + assertEquals(6, (int)app.getMajorVersion().get()); + assertThat(IOUtils.readAll(new FileReader(deployment)), is(IOUtils.readAll(app.getDeployment().get()))); + } + } diff --git a/config-application-package/src/test/resources/app-pinning-major-version/deployment.xml b/config-application-package/src/test/resources/app-pinning-major-version/deployment.xml new file mode 100644 index 00000000000..3eb207580f4 --- /dev/null +++ b/config-application-package/src/test/resources/app-pinning-major-version/deployment.xml @@ -0,0 +1,9 @@ +<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<deployment version='1.0' major-version='6'> + <test /> + <staging /> + <prod> + <region active="true">us-east</region> + <region active="false">us-west-1</region> + </prod> +</deployment> diff --git a/config-application-package/src/test/resources/app-pinning-major-version/hosts.xml b/config-application-package/src/test/resources/app-pinning-major-version/hosts.xml new file mode 100644 index 00000000000..5d2be9b0cde --- /dev/null +++ b/config-application-package/src/test/resources/app-pinning-major-version/hosts.xml @@ -0,0 +1,10 @@ +<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<hosts xmlns:deploy="vespa" xmlns:preprocess="properties"> + <preprocess:properties> + <node1.hostname>foo.yahoo.com</node1.hostname> + <node1.hostname deploy:environment="dev">bar.yahoo.com</node1.hostname> + </preprocess:properties> + <host name="${node1.hostname}"> + <alias>node1</alias> + </host> +</hosts> diff --git a/config-application-package/src/test/resources/app-pinning-major-version/searchdefinitions/music.sd b/config-application-package/src/test/resources/app-pinning-major-version/searchdefinitions/music.sd new file mode 100644 index 00000000000..c0190a4a7a8 --- /dev/null +++ b/config-application-package/src/test/resources/app-pinning-major-version/searchdefinitions/music.sd @@ -0,0 +1,8 @@ +# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +search music { + document music { + field f type string { + indexing: index | summary + } + } +} diff --git a/config-application-package/src/test/resources/app-pinning-major-version/services.xml b/config-application-package/src/test/resources/app-pinning-major-version/services.xml new file mode 100644 index 00000000000..33d1e6c5a20 --- /dev/null +++ b/config-application-package/src/test/resources/app-pinning-major-version/services.xml @@ -0,0 +1,12 @@ +<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<services version='1.0'> + <admin version='2.0'> + <adminserver hostalias='node0'/> + </admin> + <content version='1.0' id='foo'> + <redundancy>1</redundancy> + <documents> + <document type="music.sd" mode="index" /> + </documents> + </content> +</services> |