diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-01-15 14:52:31 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-01-20 13:19:08 +0100 |
commit | fbe39b00eab82c561bd6a531e0c27b547c85210d (patch) | |
tree | 8ad2ad48e1c43e0ef5b0e0b833e061d171acb695 /controller-server/src/test/java/com | |
parent | 63ce305d9728e7a8676b75f8263da0b08e5c4d4e (diff) |
Extract RoutingPolicyId
Diffstat (limited to 'controller-server/src/test/java/com')
3 files changed, 29 insertions, 28 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java index c91e5ecf1ad..89e8f8b71ad 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java @@ -1,4 +1,4 @@ -// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; import com.google.common.collect.ImmutableList; @@ -24,8 +24,9 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud; import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockMailer; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; -import com.yahoo.vespa.hosted.controller.routing.RoutingPolicy; import com.yahoo.vespa.hosted.controller.integration.ZoneApiMock; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicy; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicyId; import org.junit.Before; import org.junit.Test; @@ -50,9 +51,9 @@ import java.util.concurrent.Future; import static com.yahoo.vespa.hosted.controller.api.integration.LogEntry.Type.error; import static com.yahoo.vespa.hosted.controller.api.integration.LogEntry.Type.info; import static com.yahoo.vespa.hosted.controller.api.integration.LogEntry.Type.warning; -import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTester.instanceId; import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.applicationPackage; import static com.yahoo.vespa.hosted.controller.deployment.DeploymentContext.publicCdApplicationPackage; +import static com.yahoo.vespa.hosted.controller.deployment.DeploymentTester.instanceId; import static com.yahoo.vespa.hosted.controller.deployment.Step.Status.failed; import static com.yahoo.vespa.hosted.controller.deployment.Step.Status.succeeded; import static com.yahoo.vespa.hosted.controller.deployment.Step.Status.unfinished; @@ -209,15 +210,15 @@ public class InternalStepRunnerTest { assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installReal)); assertEquals(unfinished, tester.jobs().last(app.instanceId(), JobType.systemTest).get().stepStatuses().get(Step.installTester)); - tester.controller().curator().writeRoutingPolicies(app.instanceId(), Set.of(new RoutingPolicy(app.instanceId(), - ClusterSpec.Id.from("default"), - JobType.systemTest.zone(system()), + tester.controller().curator().writeRoutingPolicies(app.instanceId(), Set.of(new RoutingPolicy(new RoutingPolicyId(app.instanceId(), + ClusterSpec.Id.from("default"), + JobType.systemTest.zone(system())), HostName.from("host"), Optional.empty(), emptySet(), true))); - tester.controller().curator().writeRoutingPolicies(app.testerId().id(), Set.of(new RoutingPolicy(app.testerId().id(), - ClusterSpec.Id.from("default"), - JobType.systemTest.zone(system()), + tester.controller().curator().writeRoutingPolicies(app.testerId().id(), Set.of(new RoutingPolicy(new RoutingPolicyId(app.testerId().id(), + ClusterSpec.Id.from("default"), + JobType.systemTest.zone(system())), HostName.from("host"), Optional.empty(), emptySet(), true))); 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 479ae6bceba..2c39a9a18f6 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 @@ -8,6 +8,7 @@ import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.routing.RoutingPolicy; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicyId; import org.junit.Test; import java.util.Iterator; @@ -27,15 +28,15 @@ public class RoutingPolicySerializerTest { public void serialization() { var owner = ApplicationId.defaultId(); var endpoints = Set.of(EndpointId.of("r1"), EndpointId.of("r2")); - var policies = ImmutableSet.of(new RoutingPolicy(owner, - ClusterSpec.Id.from("my-cluster1"), - ZoneId.from("prod", "us-north-1"), + var policies = ImmutableSet.of(new RoutingPolicy(new RoutingPolicyId(owner, + ClusterSpec.Id.from("my-cluster1"), + ZoneId.from("prod", "us-north-1")), HostName.from("long-and-ugly-name"), Optional.of("zone1"), endpoints, true), - new RoutingPolicy(owner, - ClusterSpec.Id.from("my-cluster2"), - ZoneId.from("prod", "us-north-2"), + new RoutingPolicy(new RoutingPolicyId(owner, + ClusterSpec.Id.from("my-cluster2"), + ZoneId.from("prod", "us-north-2")), HostName.from("long-and-ugly-name-2"), Optional.empty(), endpoints, false)); @@ -44,9 +45,7 @@ public class RoutingPolicySerializerTest { 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.id(), actual.id()); assertEquals(expected.canonicalName(), actual.canonicalName()); assertEquals(expected.dnsZone(), actual.dnsZone()); assertEquals(expected.endpoints(), actual.endpoints()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index ec79c9f0e64..27b8b0d12ea 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -1,4 +1,4 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.restapi.application; import ai.vespa.hosted.api.MultiPartStreamer; @@ -53,7 +53,6 @@ import com.yahoo.vespa.hosted.controller.application.ClusterInfo; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics; import com.yahoo.vespa.hosted.controller.application.EndpointId; -import com.yahoo.vespa.hosted.controller.routing.RoutingPolicy; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; import com.yahoo.vespa.hosted.controller.athenz.HostedAthenzIdentities; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; @@ -66,6 +65,8 @@ import com.yahoo.vespa.hosted.controller.maintenance.RotationStatusUpdater; import com.yahoo.vespa.hosted.controller.metric.ApplicationMetrics; import com.yahoo.vespa.hosted.controller.restapi.ContainerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicy; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicyId; import com.yahoo.vespa.hosted.controller.security.AthenzCredentials; import com.yahoo.vespa.hosted.controller.security.AthenzTenantSpec; import com.yahoo.vespa.hosted.controller.tenant.AthenzTenant; @@ -1429,15 +1430,15 @@ public class ApplicationApiTest extends ControllerContainerTest { .region("us-west-1") .build(); app.submit(applicationPackage).deploy(); - Set<RoutingPolicy> policies = Set.of(new RoutingPolicy(app.instanceId(), - ClusterSpec.Id.from("default"), - ZoneId.from(Environment.prod, RegionName.from("us-west-1")), - HostName.from("lb-0-canonical-name"), - Optional.of("dns-zone-1"), Set.of(EndpointId.of("c0")), true), + Set<RoutingPolicy> policies = Set.of(new RoutingPolicy(new RoutingPolicyId(app.instanceId(), + ClusterSpec.Id.from("default"), + ZoneId.from(Environment.prod, RegionName.from("us-west-1"))), + HostName.from("lb-0-canonical-name"), + Optional.of("dns-zone-1"), Set.of(EndpointId.of("c0")), true), // Inactive policy is not included - new RoutingPolicy(app.instanceId(), - ClusterSpec.Id.from("deleted-cluster"), - ZoneId.from(Environment.prod, RegionName.from("us-west-1")), + new RoutingPolicy(new RoutingPolicyId(app.instanceId(), + ClusterSpec.Id.from("deleted-cluster"), + ZoneId.from(Environment.prod, RegionName.from("us-west-1"))), HostName.from("lb-1-canonical-name"), Optional.of("dns-zone-1"), Set.of(), false)); tester.controller().curator().writeRoutingPolicies(app.instanceId(), policies); |