summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2017-10-27 15:29:01 +0200
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2017-10-27 15:29:01 +0200
commit65fa2447b809a9d8860d5aee3c2aa3f7311e1721 (patch)
tree3d747aaa4f323a3e0fe608af20916289a50f865b
parent0437066576fb3e69dea27106d8553548f29f0f87 (diff)
Add platform issue to test
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java55
1 files changed, 34 insertions, 21 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
index 99581273d84..367901769e1 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java
@@ -1,15 +1,18 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;
+import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId;
import com.yahoo.vespa.hosted.controller.api.integration.stubs.LoggingDeploymentIssues;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
+import com.yahoo.vespa.hosted.controller.application.Change;
import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester;
import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb;
+import com.yahoo.vespa.hosted.controller.versions.VespaVersion;
import org.junit.Before;
import org.junit.Test;
@@ -36,6 +39,12 @@ public class DeploymentIssueReporterTest {
.environment(Environment.prod)
.region("corp-us-east-1")
.build();
+ private final static ApplicationPackage canaryPackage = new ApplicationPackageBuilder()
+ .environment(Environment.prod)
+ .region("corp-us-east-1")
+ .upgradePolicy("canary")
+ .build();
+
private DeploymentTester tester;
private DeploymentIssueReporter reporter;
@@ -54,19 +63,20 @@ public class DeploymentIssueReporterTest {
Long projectId1 = 10L;
Long projectId2 = 20L;
Long projectId3 = 30L;
- Long projectId4 = 40L;
// Only the first two have propertyIds set now.
Long propertyId1 = 1L;
Long propertyId2 = 2L;
Long propertyId3 = 3L;
- Long propertyId4 = 4L;
+
+ // Bump system version to 5.1 to upgrade canary app2 -- apps 1 and 3 have application changes.
+ tester.updateVersionStatus(Version.fromString("5.1"));
+
// Create and deploy one application for each of three tenants.
Application app1 = tester.createApplication("application1", "tenant1", projectId1, propertyId1);
Application app2 = tester.createApplication("application2", "tenant2", projectId2, propertyId2);
Application app3 = tester.createApplication("application3", "tenant3", projectId3, propertyId3);
- Application app4 = tester.createApplication("application4", "tenant4", projectId4, propertyId4);
// NOTE: All maintenance should be idempotent within a small enough time interval, so maintain is called twice in succession throughout.
@@ -75,19 +85,13 @@ public class DeploymentIssueReporterTest {
tester.deployAndNotify(app1, applicationPackage, true, systemTest);
tester.deployAndNotify(app1, applicationPackage, false, stagingTest);
- tester.notifyJobCompletion(component, app2, true);
- tester.deployAndNotify(app2, applicationPackage, true, systemTest);
- tester.deployAndNotify(app2, applicationPackage, true, stagingTest);
+ tester.deployCompletely(app2, canaryPackage);
tester.notifyJobCompletion(component, app3, true);
tester.deployAndNotify(app3, applicationPackage, true, systemTest);
tester.deployAndNotify(app3, applicationPackage, true, stagingTest);
tester.deployAndNotify(app3, applicationPackage, false, productionCorpUsEast1);
- tester.notifyJobCompletion(component, app4, true);
- tester.deployAndNotify(app4, applicationPackage, true, systemTest);
- tester.deployAndNotify(app4, applicationPackage, true, stagingTest);
-
reporter.maintain();
reporter.maintain();
assertEquals("No deployments are detected as failing for a long time initially.", 0, issues.size());
@@ -111,30 +115,21 @@ public class DeploymentIssueReporterTest {
reporter.maintain();
assertTrue("Issue is re-filed for app3.", issues.isOpenFor(app3.id()));
-
// Some time passes; tenant1 leaves her issue unattended, while tenant3 starts work and updates the issue.
- // apps 2 and 2 also have intermittent failures; see that we detect this as a Vespa problem, and file an issue to ourselves.
- tester.deployAndNotify(app2, applicationPackage, false, productionCorpUsEast1);
- tester.deployAndNotify(app4, applicationPackage, false, productionCorpUsEast1);
tester.clock().advance(maxInactivity.plus(maxFailureAge));
issues.touchFor(app3.id());
- assertFalse("We have no platform issues initially.", issues.platformIssue());
- tester.updateVersionStatus();
reporter.maintain();
reporter.maintain();
System.err.println(tester.controller().versionStatus().version(tester.controller().systemVersion()).statistics().failing());
System.err.println(tester.controller().systemVersion());
System.err.println(tester.controller().applications().require(app1.id()).deploymentJobs().jobStatus().get(component).lastCompleted().get().version());
+ System.err.println(tester.controller().applications().require(app1.id()).deploying().get() instanceof Change.ApplicationChange);
assertEquals("The issue for app1 is escalated once.", 1, issues.escalationLevelFor(app1.id()));
- // assertTrue("We get a platform issue when confidence is broken", issues.platformIssue());
- // assertFalse("No issue is filed for app2 while Vespa is considered broken.", issues.isOpenFor(app2.id()));
- // apps 2-4 fix their problems, but the ticket for app3 is left open; see the resolved ticket is not escalated when another escalation period has passed.
- tester.deployAndNotify(app2, applicationPackage, true, productionCorpUsEast1);
+ // app3 fixes their problems, but the ticket for app3 is left open; see the resolved ticket is not escalated when another escalation period has passed.
tester.deployAndNotify(app3, applicationPackage, true, productionCorpUsEast1);
- tester.deployAndNotify(app4, applicationPackage, true, productionCorpUsEast1);
tester.clock().advance(maxInactivity.plus(Duration.ofDays(1)));
reporter.maintain();
@@ -154,6 +149,24 @@ public class DeploymentIssueReporterTest {
reporter.maintain();
reporter.maintain();
assertTrue("A new issue is filed for app3.", issues.isOpenFor(app3.id()));
+
+ System.err.println(tester.controller().versionStatus().systemVersion().get().versionNumber());
+
+ // Bump system version to 5.2 to upgrade canary app2.
+ Version version = Version.fromString("5.2");
+ tester.updateVersionStatus(version);
+ assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber());
+ tester.upgrader().maintain();
+
+ tester.completeUpgradeWithError(app2, version, canaryPackage, systemTest);
+ tester.updateVersionStatus(version);
+ assertEquals(VespaVersion.Confidence.broken, tester.controller().versionStatus().systemVersion().get().confidence());
+
+ assertFalse("We have no platform issues initially.", issues.platformIssue());
+ reporter.maintain();
+ reporter.maintain();
+ assertTrue("We get a platform issue when confidence is broken", issues.platformIssue());
+
}