diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2022-02-21 21:55:10 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2022-02-22 12:20:27 +0100 |
commit | 2aa8213873330a461e9b49ae257d01eb08648495 (patch) | |
tree | f56c05271df57e0d06add5ced348b970f11cd08a /config-model-api/src/test | |
parent | 96916710a1b46cbed64f15345e56a3a68df235f5 (diff) |
Do not roll out new application package with pure deployment orchestration changes
Diffstat (limited to 'config-model-api/src/test')
-rw-r--r-- | config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java index 86a2ede85ab..5efa49b3656 100644 --- a/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java +++ b/config-model-api/src/test/java/com/yahoo/config/application/api/DeploymentSpecTest.java @@ -25,6 +25,7 @@ import static com.yahoo.config.application.api.Notifications.When.failing; import static com.yahoo.config.application.api.Notifications.When.failingCommit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -1337,6 +1338,131 @@ public class DeploymentSpecTest { } } + @Test + public void testDeployableHash() { + assertEquals(DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='default' />\n" + + "</deployment>").deployableHashCode(), + DeploymentSpec.fromXml("<deployment major-version='9'>\n" + + " <instance id='default'>\n" + + " <test />\n" + + " <staging tester-flavor='2-8-50' />\n" + + " <block-change days='mon' />\n" + + " <upgrade policy='canary' revision-target='next' revision-change='when-clear' rollout='simultaneous' />\n" + + " <prod />\n" + + " <notifications>\n" + + " <email role='author' />\n" + + " <email address='dev@duff' />\n" + + " </notifications>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertEquals(DeploymentSpec.fromXml("<deployment>\n" + + " <parallel>\n" + + " <instance id='one'>\n" + + " <prod>\n" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + " <instance id='two' />" + + " </parallel>\n" + + "</deployment>").deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='one'>\n" + + " <prod>\n" + + " <steps>\n" + + " <region>name</region>\n" + + " <delay hours='3' />\n" + + " <test>name</test>\n" + + " </steps>\n" + + " </prod>\n" + + " </instance>\n" + + " <instance id='two' />" + + "</deployment>").deployableHashCode()); + + String referenceSpec = "<deployment>\n" + + " <instance id='default'>" + + " <prod>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>"; + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment />").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='default' />\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='custom'>" + + " <prod>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='custom'>" + + " <prod>" + + " <region>other</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment athenz-domain='domain' athenz-service='service'>\n" + + " <instance id='default'>" + + " <prod>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment athenz-domain='domain'>\n" + + " <instance id='default' athenz-service='service'>" + + " <prod>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment athenz-domain='domain'>\n" + + " <instance id='default'>" + + " <prod athenz-service='prod'>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='default'>" + + " <prod global-service-id='service'>" + + " <region>name</region>\n" + + " </prod>\n" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + + assertNotEquals(DeploymentSpec.fromXml(referenceSpec).deployableHashCode(), + DeploymentSpec.fromXml("<deployment>\n" + + " <instance id='default'>" + + " <prod>" + + " <region>name</region>\n" + + " </prod>\n" + + " <endpoints>" + + " <endpoint container-id=\"quux\" />" + + " </endpoints>" + + " </instance>\n" + + "</deployment>").deployableHashCode()); + } + private static void assertInvalid(String deploymentSpec, String errorMessagePart) { assertInvalid(deploymentSpec, errorMessagePart, new ManualClock()); } |