summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-04-08 14:23:21 +0200
committerjonmv <venstad@gmail.com>2022-04-08 14:23:21 +0200
commit11e6c9aa2b5c7ca1660770d5cd366075210fa058 (patch)
treea2425637d9bdc11e0049665cd5fff705671447de /controller-api
parent20b5d3800417660cb8ea35886366af973d252417 (diff)
Use DomainName for routing names, and fix invalid unit test names
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java6
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java7
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java16
5 files changed, 24 insertions, 11 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
index 8d752208bd5..e429731ba52 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
@@ -1,10 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
+import java.net.InetAddress;
import java.net.URI;
import java.util.List;
import java.util.Optional;
@@ -32,10 +34,10 @@ public interface TesterCloud {
boolean testerReady(DeploymentId deploymentId);
/** Returns the IP address of the given host name, if any. */
- Optional<String> resolveHostName(HostName hostname);
+ Optional<InetAddress> resolveHostName(DomainName hostname);
/** Returns the host name of the given CNAME, if any. */
- Optional<HostName> resolveCname(HostName hostName);
+ Optional<DomainName> resolveCname(DomainName hostName);
/** Returns the test report as JSON if available */
Optional<TestReport> getTestReport(DeploymentId deploymentId);
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
index 766410179c1..81d55c50d69 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import java.util.Objects;
@@ -12,11 +13,11 @@ import java.util.Objects;
*/
public abstract class AliasTarget {
- private final HostName name;
+ private final DomainName name;
private final String dnsZone;
private final String id;
- public AliasTarget(HostName name, String dnsZone, String id) {
+ public AliasTarget(DomainName name, String dnsZone, String id) {
this.name = Objects.requireNonNull(name, "name must be non-null");
this.dnsZone = Objects.requireNonNull(dnsZone, "dnsZone must be non-null");
this.id = Objects.requireNonNull(id, "id must be non-null");
@@ -28,7 +29,7 @@ public abstract class AliasTarget {
}
/** DNS name this points to */
- public final HostName name() {
+ public final DomainName name() {
return name;
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
index bcb85857868..c898796f4ea 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.config.provision.zone.ZoneId;
@@ -15,7 +16,7 @@ public class LatencyAliasTarget extends AliasTarget {
private final ZoneId zone;
- public LatencyAliasTarget(HostName name, String dnsZone, ZoneId zone) {
+ public LatencyAliasTarget(DomainName name, String dnsZone, ZoneId zone) {
super(name, dnsZone, zone.value());
this.zone = Objects.requireNonNull(zone);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
index cae733427ec..c26c17cfc11 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.config.provision.zone.ZoneId;
@@ -18,7 +19,7 @@ public class WeightedAliasTarget extends AliasTarget {
private final long weight;
- public WeightedAliasTarget(HostName name, String dnsZone, ZoneId zone, long weight) {
+ public WeightedAliasTarget(DomainName name, String dnsZone, ZoneId zone, long weight) {
super(name, dnsZone, zone.value());
this.weight = weight;
if (weight < 0) throw new IllegalArgumentException("Weight cannot be negative");
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
index 673086b779c..5496b6022fd 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.stubs;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
@@ -10,7 +11,9 @@ import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
+import java.net.InetAddress;
import java.net.URI;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -57,15 +60,20 @@ public class MockTesterCloud implements TesterCloud {
}
@Override
- public Optional<String> resolveHostName(HostName hostname) {
- return Optional.of("1.2.3.4");
+ public Optional<InetAddress> resolveHostName(DomainName hostname) {
+ try {
+ return Optional.of(InetAddress.getByAddress(new byte[]{ 1, 2, 3, 4 }));
+ }
+ catch (UnknownHostException e) {
+ throw new IllegalStateException("should not happen");
+ }
}
@Override
- public Optional<HostName> resolveCname(HostName hostName) {
+ public Optional<DomainName> resolveCname(DomainName hostName) {
return nameService.findRecords(Record.Type.CNAME, RecordName.from(hostName.value())).stream()
.findFirst()
- .map(record -> HostName.of(record.data().asString().substring(0, record.data().asString().length() - 1)));
+ .map(record -> DomainName.of(record.data().asString().substring(0, record.data().asString().length() - 1)));
}
@Override