diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-03-18 14:30:33 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-03-18 14:34:02 +0100 |
commit | 6dbdc482cb824c92184d44c59ac013382f67881f (patch) | |
tree | f35fcc59e32e5050b0b1480640a8898581126612 /controller-server/src | |
parent | b37ede37fd837c2f7af12950ce78eb4dd2a5a9c2 (diff) |
Test deployment while unreadable application exists
Diffstat (limited to 'controller-server/src')
2 files changed, 16 insertions, 4 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java index e003c362b95..71b1fb9b2e4 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java @@ -126,6 +126,7 @@ public class RotationRepository { } private List<AssignedRotation> assignRotationsTo(List<Endpoint> endpoints, Instance instance, RotationLock lock) { + if (endpoints.isEmpty()) return List.of(); // No endpoints declared, nothing to assign. var availableRotations = new ArrayList<>(availableRotations(lock).values()); var assignedRotationsByEndpointId = instance.rotations().stream() .collect(Collectors.toMap(AssignedRotation::endpointId, diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index c04f745c043..27bcb4bd49a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -946,20 +946,31 @@ public class ControllerTest { var db = new MockCuratorDb(); var tester = new DeploymentTester(new ControllerTester(db)); - // Create two applications - tester.newDeploymentContext("t1", "a1", "default"); - tester.newDeploymentContext("t2", "a2", "default"); + // Create and deploy two applications + var app1 = tester.newDeploymentContext("t1", "a1", "default") + .submit() + .deploy(); + var app2 = tester.newDeploymentContext("t2", "a2", "default") + .submit() + .deploy(); assertEquals(2, tester.applications().readable().size()); // Write invalid data to one application - db.curator().set(Path.fromString("/controller/v1/applications/t2:a2"), new byte[]{(byte) 0xDE, (byte) 0xAD}); + db.curator().set(Path.fromString("/controller/v1/applications/" + app2.application().id().serialized()), + new byte[]{(byte) 0xDE, (byte) 0xAD}); + + // Can read the remaining readable assertEquals(1, tester.applications().readable().size()); + // Unconditionally reading all applications fails try { tester.applications().asList(); fail("Expected exception"); } catch (Exception ignored) { } + + // Deployment for readable application still succeeds + app1.submit().deploy(); } } |