diff options
author | Harald Musum <musum@yahooinc.com> | 2024-01-18 15:25:39 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2024-01-18 15:25:39 +0100 |
commit | a9d8a7104c55bfd5b26529f2f3a4ee4c1a840ce3 (patch) | |
tree | 4ffb6210f19f5d8bb9a26655011ad32b99df0fc4 /config-model/src/test | |
parent | ab54f9c7cbd1bc3c1434717b875e1dfeb7b27dc4 (diff) |
Support minimum-required-vespa-version attribute
If attribute is set and the running Vespa version is lower than the
specified version deployment will fail with invalid application package
error
Diffstat (limited to 'config-model/src/test')
-rwxr-xr-x | config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilderTest.java | 15 | ||||
-rw-r--r-- | config-model/src/test/schema-test-files/services-hosted-infrastructure.xml | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilderTest.java index 66a64681c60..2d5b1a307cd 100755 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilderTest.java @@ -17,6 +17,7 @@ import java.io.StringReader; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; /** * @author gjoranv @@ -99,6 +100,20 @@ public class VespaDomBuilderTest { assertEquals("hosts [" + host.getHostname() + "]", hostSystem.toString()); } + @Test + void testMinimumRequiredVespaVersion() { + var exception = assertThrows(IllegalArgumentException.class, + () -> createModel(hosts, """ + <services minimum-required-vespa-version='1.0.1' > + </services>""")); + assertEquals("Cannot deploy application, minimum required Vespa version is specified as 1.0.1 in services.xml, this Vespa version is 1.0.0.", + exception.getMessage()); + + createModel(hosts, """ + <services minimum-required-vespa-version='1.0.0' > + </services>"""); + } + private VespaModel createModel(String hosts, String services) { VespaModelCreatorWithMockPkg creator = new VespaModelCreatorWithMockPkg(hosts, services); return creator.create(); diff --git a/config-model/src/test/schema-test-files/services-hosted-infrastructure.xml b/config-model/src/test/schema-test-files/services-hosted-infrastructure.xml index b1711906086..9144b1ad0f8 100644 --- a/config-model/src/test/schema-test-files/services-hosted-infrastructure.xml +++ b/config-model/src/test/schema-test-files/services-hosted-infrastructure.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> <!-- Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services version="1.0" application-type="hosted-infrastructure"> +<services version="1.0" application-type="hosted-infrastructure" minimum-required-vespa-version="8.0.0"> <admin version="4.0"> <slobroks><nodes count="3" flavor="small"/></slobroks> |