summaryrefslogtreecommitdiffstats
path: root/controller-server/src/test/java
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2019-05-27 16:00:58 +0200
committerØyvind Grønnesby <oyving@verizonmedia.com>2019-05-27 16:00:58 +0200
commitb4c7bc329f5400e241daf625f9926dd4c89705fb (patch)
treec96f5027efbaf138594f684a1525c7648a0e9d4e /controller-server/src/test/java
parente823c91306d06af0ad8d77e6c6cafdfb5c5c2d32 (diff)
Make rotations be List<> instead of Optional<>
This allows us to have multiple rotations assigned to service, which in the future allows multiple rotations per application.
Diffstat (limited to 'controller-server/src/test/java')
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepositoryTest.java12
3 files changed, 9 insertions, 9 deletions
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 7dcb4aba138..b89941b5d2d 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
@@ -436,7 +436,7 @@ public class ControllerTest {
.build();
tester.deployCompletely(app1, applicationPackage);
app1 = tester.applications().require(app1.id());
- assertEquals("rotation-id-02", app1.rotation().get().asString());
+ assertEquals("rotation-id-02", app1.rotations().get(0).asString());
// Existing DNS records are updated to point to the newly assigned rotation
assertEquals(6, tester.controllerTester().nameService().records().size());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
index d7c0ac9fe9e..7b89b77d105 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java
@@ -115,7 +115,7 @@ public class ApplicationSerializerTest {
OptionalInt.of(7),
new MetricsService.ApplicationMetrics(0.5, 0.9),
Optional.of("-----BEGIN PUBLIC KEY-----\n∠( ᐛ 」∠)_\n-----END PUBLIC KEY-----"),
- Optional.of(new RotationId("my-rotation")),
+ List.of(new RotationId("my-rotation")),
rotationStatus);
Application serialized = applicationSerializer.fromSlime(applicationSerializer.toSlime(original));
@@ -151,7 +151,7 @@ public class ApplicationSerializerTest {
assertEquals(original.change(), serialized.change());
assertEquals(original.pemDeployKey(), serialized.pemDeployKey());
- assertEquals(original.rotation().get(), serialized.rotation().get());
+ assertEquals(original.rotations(), serialized.rotations());
assertEquals(original.rotationStatus(), serialized.rotationStatus());
// Test cluster utilization
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 8d1f40260e3..02a82e35f10 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
@@ -14,10 +14,11 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.net.URI;
+import java.util.List;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author Oyvind Gronnesby
@@ -64,7 +65,7 @@ public class RotationRepositoryTest {
Rotation expected = new Rotation(new RotationId("foo-1"), "foo-1.com");
application = tester.applications().require(application.id());
- assertEquals(expected.id(), application.rotation().get());
+ assertEquals(List.of(expected.id()), application.rotations());
assertEquals(URI.create("https://app1--tenant1.global.vespa.oath.cloud:4443/"),
application.endpointsIn(SystemName.main).main().get().url());
try (RotationLock lock = repository.lock()) {
@@ -80,7 +81,7 @@ public class RotationRepositoryTest {
.searchDefinition("search foo { }") // Update application package so there is something to deploy
.build();
tester.deployCompletely(application, applicationPackage, 43);
- assertEquals(expected.id(), tester.applications().require(application.id()).rotation().get());
+ assertEquals(List.of(expected.id()), tester.applications().require(application.id()).rotations());
}
@Test
@@ -139,8 +140,7 @@ public class RotationRepositoryTest {
.build();
tester.deployCompletely(application, applicationPackage);
Application app = tester.applications().require(application.id());
- Optional<RotationId> rotation = app.rotation();
- assertFalse(rotation.isPresent());
+ assertTrue(app.rotations().isEmpty());
}
@Test
@@ -153,7 +153,7 @@ public class RotationRepositoryTest {
Application application = tester.createApplication("app2", "tenant2", 22L,
2L);
tester.deployCompletely(application, applicationPackage);
- assertEquals(new RotationId("foo-1"), tester.applications().require(application.id()).rotation().get());
+ assertEquals(List.of(new RotationId("foo-1")), tester.applications().require(application.id()).rotations());
assertEquals("https://cd--app2--tenant2.global.vespa.oath.cloud:4443/", tester.applications().require(application.id())
.endpointsIn(SystemName.cd).main().get().url().toString());
}