summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2019-06-14 01:17:55 +0200
committerHåkon Hallingstad <hakon@verizonmedia.com>2019-06-14 01:17:55 +0200
commit6876f42d547e0c650471155097a0be027f88a52d (patch)
tree718f462c451c094a5f669c73fcb72be2faa90cc6
parent7d2366a939f64f964a208e01c4455dd530f833c6 (diff)
Remove cloud from ZoneId
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java20
-rw-r--r--config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java3
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneFilterMock.java18
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/delete-with-active-deployments.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/us-east-3-log-without-first.json2
7 files changed, 15 insertions, 36 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
index c6aaf05492e..5e664e00b4c 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
@@ -18,17 +18,13 @@ import java.util.Objects;
public class ZoneId {
// TODO: Replace usages of environment + region with usages of this.
- // TODO: Remove static factory methods not specifying cloud and system
-
private final Environment environment;
private final RegionName region;
- private final CloudName cloud;
private final SystemName system;
private ZoneId(Environment environment, RegionName region, CloudName cloud, SystemName system) {
this.environment = Objects.requireNonNull(environment, "environment must be non-null");
this.region = Objects.requireNonNull(region, "region must be non-null");
- this.cloud = Objects.requireNonNull(cloud, "cloud must be non-null");
this.system = Objects.requireNonNull(system, "system must be non-null");
}
@@ -69,10 +65,6 @@ public class ZoneId {
return new ZoneId(environment, region, cloud, SystemName.defaultSystem());
}
- public static ZoneId from(String environment, String region, String cloud) {
- return new ZoneId(Environment.from(environment), RegionName.from(region), CloudName.from(cloud), SystemName.defaultSystem());
- }
-
public static ZoneId from(String environment, String region, String cloud, String system) {
return new ZoneId(Environment.from(environment), RegionName.from(region), CloudName.from(cloud), SystemName.from(system));
}
@@ -89,10 +81,6 @@ public class ZoneId {
return region;
}
- public CloudName cloud() {
- return cloud;
- }
-
public SystemName system() {
return system;
}
@@ -100,20 +88,14 @@ public class ZoneId {
/** Returns the serialised value of this. Inverse of {@code ZoneId.from(String value)}. */
public String value() {
return environment + "." + region;
- // TODO: Change to the below when there only methods use constructor including cloud and system are used and
- // all serialized values contain cloud and system
- // return cloud + "." + system + "." + environment + "." + region;
}
@Override
public String toString() {
- return "zone " + value() + " in " + cloud;
- // TODO: Use the below (need to fix some use of toString() in tests first)
- //return "zone " + cloud + "." + system + "." + environment + "." + region;
+ return value();
}
@Override
- // TODO: Update to check cloud and system when everyone use methods that specify cloud and system
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
diff --git a/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java b/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java
index 83f8412f66b..27d45ba7d7d 100644
--- a/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java
+++ b/config-provisioning/src/test/java/com/yahoo/config/provision/ZoneIdTest.java
@@ -26,19 +26,16 @@ public class ZoneIdTest {
ZoneId zoneId = ZoneId.from(environment, region);
assertEquals(region, zoneId.region());
assertEquals(environment, zoneId.environment());
- assertEquals(CloudName.defaultName(), zoneId.cloud());
assertEquals(SystemName.defaultSystem(), zoneId.system());
ZoneId zoneIdWithSystem = ZoneId.from(system, environment, region);
assertEquals(region, zoneIdWithSystem.region());
assertEquals(environment, zoneIdWithSystem.environment());
- assertEquals(CloudName.defaultName(), zoneIdWithSystem.cloud());
assertEquals(system, zoneIdWithSystem.system());
ZoneId zoneIdWithCloudAndSystem = ZoneId.from(environment, region, cloud, system);
assertEquals(region, zoneIdWithCloudAndSystem.region());
assertEquals(environment, zoneIdWithCloudAndSystem.environment());
- assertEquals(cloud, zoneIdWithCloudAndSystem.cloud());
assertEquals(system, zoneIdWithCloudAndSystem.system());
}
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 4fb6a2e34fb..095651df033 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
@@ -374,7 +374,7 @@ public class InternalStepRunnerTest {
tester.runner().run();
assertEquals(failed, tester.jobs().run(id).get().steps().get(Step.endTests));
assertTestLogEntries(id, Step.copyVespaLogs,
- new LogEntry(lastId + 2, tester.clock().millis(), debug, "Copying Vespa log from nodes of tenant.application in zone test.us-east-1 in default ..."),
+ new LogEntry(lastId + 2, tester.clock().millis(), debug, "Copying Vespa log from nodes of tenant.application in test.us-east-1 ..."),
new LogEntry(lastId + 3, 1554970337084L, info,
"17480180-v6-3.ostk.bm2.prod.ne1.yahoo.com\tcontainer\tContainer.com.yahoo.container.jdisc.ConfiguredApplication\n" +
"Switching to the latest deployed set of configurations and components. Application switch number: 2"),
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneFilterMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneFilterMock.java
index 5cf8268c18e..700e6e9cb42 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneFilterMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ZoneFilterMock.java
@@ -43,7 +43,7 @@ public class ZoneFilterMock implements ZoneList {
@Override
public ZoneList all() {
- return filter(zoneId -> true);
+ return filter(zone -> true);
}
@Override
@@ -63,17 +63,17 @@ public class ZoneFilterMock implements ZoneList {
@Override
public ZoneList in(Environment... environments) {
- return filter(zoneId -> new HashSet<>(Arrays.asList(environments)).contains(zoneId.environment()));
+ return filter(zone -> new HashSet<>(Arrays.asList(environments)).contains(zone.getEnvironment()));
}
@Override
public ZoneList in(RegionName... regions) {
- return filter(zoneId -> new HashSet<>(Arrays.asList(regions)).contains(zoneId.region()));
+ return filter(zone -> new HashSet<>(Arrays.asList(regions)).contains(zone.getRegionName()));
}
@Override
public ZoneList among(ZoneId... zones) {
- return filter(zoneId -> new HashSet<>(Arrays.asList(zones)).contains(zoneId));
+ return filter(zone -> new HashSet<>(Arrays.asList(zones)).contains(zone.getId()));
}
@Override
@@ -88,15 +88,15 @@ public class ZoneFilterMock implements ZoneList {
@Override
public ZoneList ofCloud(CloudName cloud) {
- return filter(zoneId -> zoneId.cloud().equals(cloud));
+ return filter(zone -> zone.getCloudName().equals(cloud));
}
- private ZoneFilterMock filter(Predicate<ZoneId> condition) {
+ private ZoneFilterMock filter(Predicate<ZoneApi> condition) {
return new ZoneFilterMock(
zones.stream()
- .filter(zoneApi -> negate ?
- condition.negate().test(zoneApi.toDeprecatedId()) :
- condition.test(zoneApi.toDeprecatedId()))
+ .filter(zone -> negate ?
+ condition.negate().test(zone) :
+ condition.test(zone))
.collect(Collectors.toList()),
false);
}
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 632fea8cb1f..99ea9cc02d0 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
@@ -719,14 +719,14 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Invalid deployment fails
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-east-3/instance/default/global-rotation", GET)
.userIdentity(USER_ID),
- "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1' has no deployment in zone prod.us-east-3 in default\"}",
+ "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1' has no deployment in prod.us-east-3\"}",
404);
// Change status of non-existing deployment fails
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-east-3/instance/default/global-rotation/override", PUT)
.userIdentity(USER_ID)
.data("{\"reason\":\"unit-test\"}"),
- "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1' has no deployment in zone prod.us-east-3 in default\"}",
+ "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1' has no deployment in prod.us-east-3\"}",
404);
// GET global rotation status
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/delete-with-active-deployments.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/delete-with-active-deployments.json
index 012b0031489..25fed881dec 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/delete-with-active-deployments.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/delete-with-active-deployments.json
@@ -1,4 +1,4 @@
{
"error-code": "BAD_REQUEST",
- "message": "Could not delete 'application 'tenant1.application1'': It has active deployments in: zone dev.us-east-1 in default, zone prod.us-central-1 in default"
+ "message": "Could not delete 'application 'tenant1.application1'': It has active deployments in: dev.us-east-1, prod.us-central-1"
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/us-east-3-log-without-first.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/us-east-3-log-without-first.json
index 77d5b3479be..390024fe33d 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/us-east-3-log-without-first.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/us-east-3-log-without-first.json
@@ -12,7 +12,7 @@
{
"at": 1000,
"type": "debug",
- "message": "Deactivating tester of tenant.application in zone prod.us-east-3 in default ..."
+ "message": "Deactivating tester of tenant.application in prod.us-east-3 ..."
}
]
},