aboutsummaryrefslogtreecommitdiffstats
path: root/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java143
1 files changed, 51 insertions, 92 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index c270b4559f9..3925899e1cd 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.http.v2;
-import ai.vespa.http.DomainName;
import ai.vespa.http.HttpURL;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.component.Version;
@@ -10,10 +9,6 @@ import com.yahoo.config.model.api.PortInfo;
import com.yahoo.config.model.api.ServiceInfo;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
-import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.config.provision.EndpointsChecker;
-import com.yahoo.config.provision.EndpointsChecker.Availability;
-import com.yahoo.config.provision.EndpointsChecker.Endpoint;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.Zone;
@@ -58,7 +53,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
-import java.net.InetAddress;
import java.net.URI;
import java.net.URLEncoder;
import java.time.Duration;
@@ -66,7 +60,6 @@ import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -84,12 +77,10 @@ import static com.yahoo.vespa.config.server.http.HandlerTest.assertHttpStatusCod
import static com.yahoo.vespa.config.server.http.SessionHandlerTest.getRenderedString;
import static com.yahoo.vespa.config.server.http.v2.ApplicationHandler.HttpServiceListResponse;
import static com.yahoo.vespa.config.server.http.v2.ApplicationHandler.HttpServiceResponse.createResponse;
-import static com.yahoo.yolean.Exceptions.uncheck;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
@@ -116,8 +107,6 @@ public class ApplicationHandlerTest {
private MockProvisioner provisioner;
private OrchestratorMock orchestrator;
private ManualClock clock;
- private List<Endpoint> expectedEndpoints;
- private Availability availability;
@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -150,7 +139,6 @@ public class ApplicationHandlerTest {
.withLogRetriever(logRetriever)
.withConfigserverConfig(configserverConfig)
.withSecretStoreValidator(secretStoreValidator)
- .withEndpointsChecker(endpoints -> { assertEquals(expectedEndpoints, endpoints); return availability; })
.build();
}
@@ -516,35 +504,6 @@ public class ApplicationHandlerTest {
}
@Test
- public void testVerifyEndpoints() {
- expectedEndpoints = List.of(new Endpoint(ClusterSpec.Id.from("bluster"),
- HttpURL.from(URI.create("https://bluster.tld:1234")),
- Optional.of(uncheck(() -> InetAddress.getByName("4.3.2.1"))),
- Optional.of(DomainName.of("fluster.tld")),
- false));
- availability = new Availability(EndpointsChecker.Status.available, "Endpoints are ready");
- ApplicationHandler handler = createApplicationHandler();
- HttpRequest request = createTestRequest(toUrlPath(applicationId, Zone.defaultZone(), true) + "/verify-endpoints",
- POST,
- new ByteArrayInputStream("""
- {
- "endpoints": [
- {
- "clusterName": "bluster",
- "url": "https://bluster.tld:1234",
- "ipAddress": "4.3.2.1",
- "canonicalName": "fluster.tld",
- "public": false
- }
- ]
- }""".getBytes(UTF_8)));
- HttpResponse response = handler.handle(request);
- assertEquals(200, response.getStatus());
- assertEquals("{\"status\":\"available\",\"message\":\"Endpoints are ready\"}",
- new ByteArrayOutputStream() {{ uncheck(() -> response.render(this)); }}.toString(UTF_8));
- }
-
- @Test
public void testClusterReindexingStateSerialization() {
Stream.of(ClusterReindexing.State.values()).forEach(ClusterReindexing.State::toString);
}
@@ -633,12 +592,12 @@ public class ApplicationHandlerTest {
hostAndPort,
uri);
assertResponse("{\n" +
- " \"url\": \"" + uri.toString() + "\",\n" +
- " \"host\": \"" + hostAndPort + "\",\n" +
- " \"wantedGeneration\": 3,\n" +
- " \"converged\": true,\n" +
- " \"currentGeneration\": 3\n" +
- "}",
+ " \"url\": \"" + uri.toString() + "\",\n" +
+ " \"host\": \"" + hostAndPort + "\",\n" +
+ " \"wantedGeneration\": 3,\n" +
+ " \"converged\": true,\n" +
+ " \"currentGeneration\": 3\n" +
+ "}",
200,
response);
}
@@ -650,11 +609,11 @@ public class ApplicationHandlerTest {
uri);
assertResponse("{\n" +
- " \"url\": \"" + uri.toString() + "\",\n" +
- " \"host\": \"" + hostAndPort + "\",\n" +
- " \"wantedGeneration\": 3,\n" +
- " \"problem\": \"Host:port (service) no longer part of application, refetch list of services.\"\n" +
- "}",
+ " \"url\": \"" + uri.toString() + "\",\n" +
+ " \"host\": \"" + hostAndPort + "\",\n" +
+ " \"wantedGeneration\": 3,\n" +
+ " \"problem\": \"Host:port (service) no longer part of application, refetch list of services.\"\n" +
+ "}",
410,
response);
}
@@ -676,20 +635,20 @@ public class ApplicationHandlerTest {
3L),
requestUrl);
assertResponse("{\n" +
- " \"services\": [\n" +
- " {\n" +
- " \"host\": \"" + hostname + "\",\n" +
- " \"port\": " + port + ",\n" +
- " \"type\": \"container\",\n" +
- " \"url\": \"" + serviceUrl.toString() + "\",\n" +
- " \"currentGeneration\":" + 3 + "\n" +
- " }\n" +
- " ],\n" +
- " \"url\": \"" + requestUrl.toString() + "\",\n" +
- " \"currentGeneration\": 3,\n" +
- " \"wantedGeneration\": 3,\n" +
- " \"converged\": true\n" +
- "}",
+ " \"services\": [\n" +
+ " {\n" +
+ " \"host\": \"" + hostname + "\",\n" +
+ " \"port\": " + port + ",\n" +
+ " \"type\": \"container\",\n" +
+ " \"url\": \"" + serviceUrl.toString() + "\",\n" +
+ " \"currentGeneration\":" + 3 + "\n" +
+ " }\n" +
+ " ],\n" +
+ " \"url\": \"" + requestUrl.toString() + "\",\n" +
+ " \"currentGeneration\": 3,\n" +
+ " \"wantedGeneration\": 3,\n" +
+ " \"converged\": true\n" +
+ "}",
200,
response);
}
@@ -710,27 +669,27 @@ public class ApplicationHandlerTest {
3L),
requestUrl);
assertResponse("{\n" +
- " \"services\": [\n" +
- " {\n" +
- " \"host\": \"" + hostname + "\",\n" +
- " \"port\": " + port + ",\n" +
- " \"type\": \"container\",\n" +
- " \"url\": \"" + serviceUrl.toString() + "\",\n" +
- " \"currentGeneration\":" + 4 + "\n" +
- " },\n" +
- " {\n" +
- " \"host\": \"" + hostname2 + "\",\n" +
- " \"port\": " + port2 + ",\n" +
- " \"type\": \"container\",\n" +
- " \"url\": \"" + serviceUrl2.toString() + "\",\n" +
- " \"currentGeneration\":" + 3 + "\n" +
- " }\n" +
- " ],\n" +
- " \"url\": \"" + requestUrl.toString() + "\",\n" +
- " \"currentGeneration\": 3,\n" +
- " \"wantedGeneration\": 4,\n" +
- " \"converged\": false\n" +
- "}",
+ " \"services\": [\n" +
+ " {\n" +
+ " \"host\": \"" + hostname + "\",\n" +
+ " \"port\": " + port + ",\n" +
+ " \"type\": \"container\",\n" +
+ " \"url\": \"" + serviceUrl.toString() + "\",\n" +
+ " \"currentGeneration\":" + 4 + "\n" +
+ " },\n" +
+ " {\n" +
+ " \"host\": \"" + hostname2 + "\",\n" +
+ " \"port\": " + port2 + ",\n" +
+ " \"type\": \"container\",\n" +
+ " \"url\": \"" + serviceUrl2.toString() + "\",\n" +
+ " \"currentGeneration\":" + 3 + "\n" +
+ " }\n" +
+ " ],\n" +
+ " \"url\": \"" + requestUrl.toString() + "\",\n" +
+ " \"currentGeneration\": 3,\n" +
+ " \"wantedGeneration\": 4,\n" +
+ " \"converged\": false\n" +
+ "}",
200,
response);
}
@@ -748,11 +707,11 @@ public class ApplicationHandlerTest {
uri);
assertResponse("{\n" +
- " \"url\": \"" + uri + "\",\n" +
- " \"host\": \"" + hostAndPort + "\",\n" +
- " \"wantedGeneration\": 3,\n" +
- " \"error\": \"some error message\"" +
- "}",
+ " \"url\": \"" + uri.toString() + "\",\n" +
+ " \"host\": \"" + hostAndPort + "\",\n" +
+ " \"wantedGeneration\": 3,\n" +
+ " \"error\": \"some error message\"" +
+ "}",
404,
response);
}