diff options
author | Jon Bratseth <bratseth@oath.com> | 2019-11-29 16:43:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 16:43:05 +0200 |
commit | 21620abb46bbfb18abeb6c8cc917b39fb0e316b8 (patch) | |
tree | 27aba5a8f5e3744a1d5942583c5412b263c905d8 /config-model | |
parent | f9e224f1071912832fd61de1cf378342eafbd5af (diff) | |
parent | e32ce48a7dc7026bf0b1fe6182a872131675fa19 (diff) |
Merge pull request #11456 from vespa-engine/jvenstad/test-steps-in-deployment-spec
Jvenstad/test steps in deployment spec
Diffstat (limited to 'config-model')
8 files changed, 196 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java index e5e22c3a260..188a9b4765c 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java @@ -236,7 +236,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { Optional<DeploymentInstanceSpec> instance = spec.instance(app.getApplicationId().instance()); if (instance.isEmpty()) return false; return instance.get().zones().stream() - .anyMatch(declaredZone -> declaredZone.deploysTo(zone.environment(), Optional.of(zone.region())) && + .anyMatch(declaredZone -> declaredZone.concerns(zone.environment(), Optional.of(zone.region())) && declaredZone.active()); } diff --git a/config-model/src/main/resources/schema/deployment.rnc b/config-model/src/main/resources/schema/deployment.rnc index 1e1d9ad3aa9..6a8bc8f77b9 100644 --- a/config-model/src/main/resources/schema/deployment.rnc +++ b/config-model/src/main/resources/schema/deployment.rnc @@ -25,6 +25,11 @@ StepExceptInstance = Staging? & Prod* +PrimitiveStep = + Delay* & + Region* & + ProdTest* + Instance = element instance { attribute id { xsd:string } & attribute athenz-domain { xsd:string }? & @@ -32,8 +37,14 @@ Instance = element instance { StepExceptInstance } -ParallelRegions = element parallel { - Region* +ParallelSteps = element parallel { + SerialSteps* & + PrimitiveStep* +} + +SerialSteps = element steps { + ParallelSteps* & + PrimitiveStep* } ParallelInstances = element parallel { @@ -81,11 +92,17 @@ Prod = element prod { attribute tester-flavor { xsd:string }? & Region* & Delay* & - ParallelRegions* + ProdTest* & + ParallelSteps* +} + +ProdTest = element test { + text } Region = element region { attribute active { xsd:boolean } & + attribute athenz-service { xsd:string }? & text } diff --git a/config-model/src/test/cfg/application/app_complicated_deployment_spec/deployment.xml b/config-model/src/test/cfg/application/app_complicated_deployment_spec/deployment.xml new file mode 100644 index 00000000000..36c1d449021 --- /dev/null +++ b/config-model/src/test/cfg/application/app_complicated_deployment_spec/deployment.xml @@ -0,0 +1,48 @@ +<deployment version='1.0' athenz-domain='domain'> + <staging /> + <parallel> + <instance id='instance' athenz-service='in-service'> + <prod> + <parallel> + <region active='true'>us-west-1</region> + <steps> + <region active='true'>us-east-3</region> + <delay hours='2' /> + <region active='true'>eu-west-1</region> + <delay hours='2' /> + </steps> + <steps> + <delay hours='3' /> + <region active='true'>aws-us-east-1a</region> + <parallel> + <region active='true' athenz-service='no-service'>ap-northeast-1</region> + <region active='true'>ap-southeast-2</region> + </parallel> + </steps> + <delay hours='3' minutes='30' /> + </parallel> + <region active='true'>us-north-7</region> + </prod> + </instance> + <instance id='other'> + <upgrade policy='conservative' /> + <block-change days='sat' hours='10' time-zone='CET' /> + <test /> + <prod> + <region active='true'>eu-central-2</region> + </prod> + <notifications when='failing'> + <email role='author' /> + <email address='john@dev' when='failing-commit' /> + <email address='jane@dev' /> + </notifications> + <endpoints> + <endpoint id='foo' container-id='bar'> + <region>us-east</region> + </endpoint> + <endpoint id='nalle' container-id='frosk' /> + <endpoint container-id='quux' /> + </endpoints> + </instance> + </parallel> +</deployment> diff --git a/config-model/src/test/cfg/application/app_complicated_deployment_spec/hosts.xml b/config-model/src/test/cfg/application/app_complicated_deployment_spec/hosts.xml new file mode 100644 index 00000000000..a7fc725d377 --- /dev/null +++ b/config-model/src/test/cfg/application/app_complicated_deployment_spec/hosts.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<hosts> + <host name="bogusname1"> + <alias>node1</alias> + </host> + <host name="bogusname2"> + <alias>node2</alias> + </host> + <host name="bogusname3"> + <alias>node3</alias> + </host> + <host name="bogusname4"> + <alias>node4</alias> + </host> + <host name="bogusname5"> + <alias>node5</alias> + </host> + +</hosts> + diff --git a/config-model/src/test/cfg/application/app_complicated_deployment_spec/searchdefinitions/music.sd b/config-model/src/test/cfg/application/app_complicated_deployment_spec/searchdefinitions/music.sd new file mode 100644 index 00000000000..693afbd308d --- /dev/null +++ b/config-model/src/test/cfg/application/app_complicated_deployment_spec/searchdefinitions/music.sd @@ -0,0 +1,37 @@ +# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# A basic search definition - called music, should be saved to music.sd +search music { + + # It contains one document type only - called music as well + document music { + + field title type string { + indexing: summary | index # How this field should be indexed + # index-to: title, default # Create two indexes + rank-type: about # Type of ranking settings to apply + } + + field artist type string { + indexing: summary | attribute | index + # index-to: artist, default + rank-type:about + } + + field year type int { + indexing: summary | attribute + } + + # Increase rank score of popular documents regardless of query + field popularity type int { + indexing: summary | attribute + } + + field url type uri { + indexing: summary | index + } + + field cover type raw {} + + } + +} diff --git a/config-model/src/test/cfg/application/app_complicated_deployment_spec/services.xml b/config-model/src/test/cfg/application/app_complicated_deployment_spec/services.xml new file mode 100644 index 00000000000..9ae7f122e81 --- /dev/null +++ b/config-model/src/test/cfg/application/app_complicated_deployment_spec/services.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<services version="1.0"> + + <service version="1.0" name="myservice" command="mycmd1.sh"> + <config name="a.myconfig"> + <mysetting>bar</mysetting> + </config> + <node hostalias="node1"> + <config name="a.myconfig"> + <mysetting>baz</mysetting> + </config> + </node> + <node hostalias="node2"/> + <node hostalias="node3"/> + <node hostalias="node3"/> + </service> + + <service version="1.0" name="myotherservice" command="/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR"> + <config name="a.myconfig"> + <mysetting>bar2</mysetting> + </config> + <node hostalias="node3"> + <config name="a.myconfig"> + <mysetting>baz2</mysetting> + </config> + </node> + <node hostalias="node4"/> + <node hostalias="node5"/> + </service> + + <admin version="2.0"> + <adminserver hostalias="node1"/> + <slobroks> + <slobrok hostalias="node1"/> + <slobrok hostalias="node2"/> + </slobroks> + </admin> + + <container version="1.0"> + <nodes> + <node hostalias="node1" /> + </nodes> + + <search/> + <document-api/> + </container> + + <content id="music" version="1.0"> + <redundancy>1</redundancy> + <documents> + <document type="music" mode="index" /> + </documents> + <nodes> + <node hostalias="node1" distribution-key="0" /> + </nodes> + </content> + +</services> diff --git a/config-model/src/test/cfg/application/invalid_parallel_deployment_xml/deployment.xml b/config-model/src/test/cfg/application/invalid_parallel_deployment_xml/deployment.xml index 2f6e9b7a1a6..8e13f0abb53 100644 --- a/config-model/src/test/cfg/application/invalid_parallel_deployment_xml/deployment.xml +++ b/config-model/src/test/cfg/application/invalid_parallel_deployment_xml/deployment.xml @@ -4,9 +4,7 @@ <staging/> <prod global-service-id="query"> <parallel> - <region active="true">us-east-3</region> - <delay hours="1"/> - <region active="true">us-west-1</region> + <instance id="hello" /> </parallel> </prod> </deployment> diff --git a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java index 8a8b23bb0c8..cb1577417b4 100644 --- a/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/ApplicationDeployTest.java @@ -212,7 +212,14 @@ public class ApplicationDeployTest { } @Test - public void testThatAppWithIllegalEmptyProdRegion() throws IOException { + public void testComplicatedDeploymentSpec() throws IOException { + File tmpDir = tmpFolder.getRoot(); + IOUtils.copyDirectory(new File(TESTDIR, "app_complicated_deployment_spec"), tmpDir); + ApplicationPackageTester.create(tmpDir.getAbsolutePath()); + } + + @Test + public void testAppWithEmptyProdRegion() throws IOException { File tmpDir = tmpFolder.getRoot(); IOUtils.copyDirectory(new File(TESTDIR, "empty_prod_region_in_deployment_xml"), tmpDir); ApplicationPackageTester.create(tmpDir.getAbsolutePath()); @@ -226,7 +233,7 @@ public class ApplicationDeployTest { ApplicationPackageTester.create(tmpDir.getAbsolutePath()); fail("Expected exception"); } catch (IllegalArgumentException e) { - assertEquals("XML error in deployment.xml: element \"delay\" not allowed here; expected the element end-tag or element \"region\" [8:25], input:\n", e.getMessage()); + assertEquals("XML error in deployment.xml: element \"instance\" not allowed here; expected the element end-tag or element \"delay\", \"region\", \"steps\" or \"test\" [7:30], input:\n", e.getMessage()); } } |