aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2019-10-14 15:22:14 +0200
committerMartin Polden <mpolden@mpolden.no>2019-10-14 15:22:14 +0200
commit92d32a24edafd36fceb3880e630ab3869af3c596 (patch)
tree7ebb730d1e2f27695543c839f2cb4ee9e4fae13b /controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
parentcccd3ff48a85394bc5be508863b5d35282aabfc4 (diff)
Make getOrAssignRotation private
Diffstat (limited to 'controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
index 25ae7c88e84..b298cfcc889 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java
@@ -73,8 +73,10 @@ public class RotationRepositoryTest {
assertEquals(URI.create("https://app1--tenant1.global.vespa.oath.cloud:4443/"),
instance.endpointsIn(SystemName.main).main().get().url());
try (RotationLock lock = repository.lock()) {
- Rotation rotation = repository.getOrAssignRotation(application.deploymentSpec(), tester.applications().requireInstance(instance.id()), lock);
- assertEquals(expected, rotation);
+ List<AssignedRotation> rotations = repository.getOrAssignRotations(application.deploymentSpec(),
+ tester.applications().requireInstance(instance.id()),
+ lock);
+ assertSingleRotation(expected, rotations, repository);
}
// Deploying once more assigns same rotation
@@ -98,9 +100,9 @@ public class RotationRepositoryTest {
Instance instance2 = tester.defaultInstance(application2.id());
try (RotationLock lock = repository.lock()) {
- Rotation rotation = repository.getOrAssignRotation(application2.deploymentSpec(), instance2, lock);
+ List<AssignedRotation> rotations = repository.getOrAssignRotations(application2.deploymentSpec(), instance2, lock);
Rotation assignedRotation = new Rotation(new RotationId("foo-1"), "foo-1.com");
- assertEquals(assignedRotation, rotation);
+ assertSingleRotation(assignedRotation, rotations, repository);
}
}
@@ -156,6 +158,14 @@ public class RotationRepositoryTest {
.endpointsIn(SystemName.cd).main().get().url().toString());
}
+ private void assertSingleRotation(Rotation expected, List<AssignedRotation> assignedRotations, RotationRepository repository) {
+ assertEquals(1, assignedRotations.size());
+ var rotationId = assignedRotations.get(0).rotationId();
+ var rotation = repository.getRotation(rotationId);
+ assertTrue(rotationId + " exists", rotation.isPresent());
+ assertEquals(expected, rotation.get());
+ }
+
private static List<RotationId> rotationIds(List<AssignedRotation> assignedRotations) {
return assignedRotations.stream().map(AssignedRotation::rotationId).collect(Collectors.toUnmodifiableList());
}