summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-04-08 13:19:54 +0200
committerjonmv <venstad@gmail.com>2022-04-08 13:19:54 +0200
commit0be38d50daebe7187e026b57b38902bc53e408d6 (patch)
tree25f738e19d365cb638c4b0fa6c2a1e625572b484
parentc94ec50b539ff6d0d3273029f1278e8c90274a57 (diff)
Use null rather than "" for no load balancer, as intended(?), and fix some assertions
-rw-r--r--config-lib/src/test/java/com/yahoo/config/FileNodeTest.java5
-rw-r--r--config-lib/src/test/java/com/yahoo/config/PathNodeTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java15
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java4
-rw-r--r--container-core/src/test/java/com/yahoo/restapi/PathTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequestTest.java6
6 files changed, 20 insertions, 21 deletions
diff --git a/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java b/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java
index 1ad9f722eca..42e4978091d 100644
--- a/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java
+++ b/config-lib/src/test/java/com/yahoo/config/FileNodeTest.java
@@ -23,9 +23,8 @@ public class FileNodeTest {
assertEquals("foo.txt", n.value().value());
assertEquals("\"foo.txt\"", n.toString());
- assertThrows("path may not start with '..', but got: foo/../../boo",
- IllegalArgumentException.class,
- () -> new FileNode("foo/../../boo"));
+ assertEquals("path may not start with '..', but got: foo/../../boo",
+ assertThrows(IllegalArgumentException.class, () -> new FileNode("foo/../../boo")).getMessage());
}
}
diff --git a/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java b/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java
index 2240f647726..016c53b42e3 100644
--- a/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java
+++ b/config-lib/src/test/java/com/yahoo/config/PathNodeTest.java
@@ -22,9 +22,8 @@ public class PathNodeTest {
n = new PathNode(new FileReference("foo.txt"));
assertEquals(new File("foo.txt").toPath(), n.value());
- assertThrows("path may not start with '..', but got: foo/../../boo",
- IllegalArgumentException.class,
- () -> new PathNode(new FileReference("foo/../../boo")));
+ assertEquals("path may not start with '..', but got: foo/../../boo",
+ assertThrows(IllegalArgumentException.class, () -> new PathNode(new FileReference("foo/../../boo"))).getMessage());
}
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
index c686a813c9f..1e0c554af81 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/parser/IntermediateParserTestCase.java
@@ -74,13 +74,14 @@ public class IntermediateParserTestCase {
@Test
public void backwards_path_is_disallowed() {
- assertThrows("'..' is not allowed in path", IllegalArgumentException.class,
- () -> parseString("schema foo {\n" +
- " constant my_constant_tensor {\n" +
- " file: foo/../bar\n" +
- " type: tensor<float>(x{},y{})\n" +
- " }\n" +
- "}\n"));
+ assertEquals("'..' is not allowed in path",
+ assertThrows(IllegalArgumentException.class,
+ () -> parseString("schema foo {\n" +
+ " constant my_constant_tensor {\n" +
+ " file: foo/../bar\n" +
+ " type: tensor<float>(x{},y{})\n" +
+ " }\n" +
+ "}\n")).getMessage());
}
void checkFileParses(String fileName) throws Exception {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
index e528078ac96..91bdc3e5fa8 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
@@ -21,10 +21,10 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.AthenzDomain;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.DockerImage;
-import com.yahoo.net.HostName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.Zone;
import com.yahoo.container.jdisc.secretstore.SecretStore;
+import com.yahoo.net.HostName;
import com.yahoo.vespa.config.server.tenant.SecretStoreExternalIdRetriever;
import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagSource;
@@ -398,7 +398,7 @@ public class ModelContextImpl implements ModelContext {
this.applicationId = applicationId;
this.multitenant = configserverConfig.multitenant() || configserverConfig.hostedVespa() || Boolean.getBoolean("multitenant");
this.configServerSpecs = fromConfig(configserverConfig);
- this.loadBalancerName = HostName.of(configserverConfig.loadBalancerAddress());
+ this.loadBalancerName = configserverConfig.loadBalancerAddress().isEmpty() ? null : HostName.of(configserverConfig.loadBalancerAddress());
this.ztsUrl = configserverConfig.ztsUrl() != null ? URI.create(configserverConfig.ztsUrl()) : null;
this.athenzDnsSuffix = configserverConfig.athenzDnsSuffix();
this.hostedVespa = configserverConfig.hostedVespa();
diff --git a/container-core/src/test/java/com/yahoo/restapi/PathTest.java b/container-core/src/test/java/com/yahoo/restapi/PathTest.java
index 17b35a6343c..b0392c16e2e 100644
--- a/container-core/src/test/java/com/yahoo/restapi/PathTest.java
+++ b/container-core/src/test/java/com/yahoo/restapi/PathTest.java
@@ -68,9 +68,9 @@ public class PathTest {
public void testUrlEncodedPath() {
assertTrue(new Path(URI.create("/a/%62/c")).matches("/a/b/c"));
assertFalse(new Path(URI.create("/a/b%2fc"), __ -> { }).matches("/a/b/c"));
- assertThrows("path segments cannot be \"\", \".\", or \"..\", but got: '..'",
- IllegalArgumentException.class,
- () -> new Path(URI.create("/foo")).matches("/foo/bar/%2e%2e"));
+ assertEquals("path segments cannot be \"\", \".\", or \"..\", but got: '..'",
+ assertThrows(IllegalArgumentException.class,
+ () -> new Path(URI.create("/foo")).matches("/foo/bar/%2e%2e")).getMessage());
Path path = new Path(URI.create("/%61/%2f/%63"), __ -> { });
assertTrue(path.matches("/a/{slash}/{c}"));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequestTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequestTest.java
index 5827ef676d7..6b07fea0187 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequestTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/proxy/ProxyRequestTest.java
@@ -19,9 +19,9 @@ public class ProxyRequestTest {
@Test
public void testBadUri() {
- assertThrows("Request path '/path' does not end with proxy path '/zone/v2/'",
- IllegalArgumentException.class,
- () -> testRequest("http://domain.tld/path", "/zone/v2/"));
+ assertEquals("Request path '/path' does not end with proxy path '/zone/v2/'",
+ assertThrows(IllegalArgumentException.class,
+ () -> testRequest("http://domain.tld/path", "/zone/v2/")).getMessage());
}
@Test