aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2019-05-02 11:35:51 +0200
committerMartin Polden <mpolden@mpolden.no>2019-05-02 12:45:17 +0200
commit3158e4d0322b95d1f4eaef86d970e19807c52573 (patch)
tree0392eb0bdb7bfb75cefb4c755827a0cf6b9465ff
parentdc8f7668907fdd198b3c8af4cf0b3fb6d3371a05 (diff)
Test all fields
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java43
1 files changed, 27 insertions, 16 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java
index 1aefe3f62bd..a0e95bd0393 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java
@@ -10,6 +10,7 @@ import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.application.RoutingPolicy;
import org.junit.Test;
+import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
@@ -24,22 +25,32 @@ public class RoutingPolicySerializerTest {
@Test
public void test_serialization() {
- ApplicationId owner = ApplicationId.defaultId();
- Set<RotationName> rotations = Set.of(RotationName.from("r1"), RotationName.from("r2"));
- Set<RoutingPolicy> loadBalancers = ImmutableSet.of(new RoutingPolicy(owner,
- ClusterSpec.Id.from("my-cluster1"),
- ZoneId.from("prod", "us-north-1"),
- HostName.from("long-and-ugly-name"),
- Optional.of("zone1"),
- rotations),
- new RoutingPolicy(owner,
- ClusterSpec.Id.from("my-cluster2"),
- ZoneId.from("prod", "us-north-2"),
- HostName.from("long-and-ugly-name-2"),
- Optional.empty(),
- rotations));
- Set<RoutingPolicy> serialized = serializer.fromSlime(owner, serializer.toSlime(loadBalancers));
- assertEquals(loadBalancers, serialized);
+ var owner = ApplicationId.defaultId();
+ var rotations = Set.of(RotationName.from("r1"), RotationName.from("r2"));
+ var policies = ImmutableSet.of(new RoutingPolicy(owner,
+ ClusterSpec.Id.from("my-cluster1"),
+ ZoneId.from("prod", "us-north-1"),
+ HostName.from("long-and-ugly-name"),
+ Optional.of("zone1"),
+ rotations),
+ new RoutingPolicy(owner,
+ ClusterSpec.Id.from("my-cluster2"),
+ ZoneId.from("prod", "us-north-2"),
+ HostName.from("long-and-ugly-name-2"),
+ Optional.empty(),
+ rotations));
+ var serialized = serializer.fromSlime(owner, serializer.toSlime(policies));
+ assertEquals(policies.size(), serialized.size());
+ for (Iterator<RoutingPolicy> it1 = policies.iterator(), it2 = serialized.iterator(); it1.hasNext();) {
+ var expected = it1.next();
+ var actual = it2.next();
+ assertEquals(expected.owner(), actual.owner());
+ assertEquals(expected.cluster(), actual.cluster());
+ assertEquals(expected.zone(), actual.zone());
+ assertEquals(expected.canonicalName(), actual.canonicalName());
+ assertEquals(expected.dnsZone(), actual.dnsZone());
+ assertEquals(expected.rotations(), actual.rotations());
+ }
}
}