diff options
author | Ola Aunrønning <ola.aunroe@gmail.com> | 2018-09-19 09:23:31 +0200 |
---|---|---|
committer | Ola Aunrønning <ola.aunroe@gmail.com> | 2018-09-19 09:30:39 +0200 |
commit | 80fc2a6b791f035cef44df047232e29a3d17925a (patch) | |
tree | c89fe375fccaef4a69099064c0636e6792389f21 /configserver | |
parent | 4d6acff9649baf0f7ed8468624b181fcbf3ffeb7 (diff) |
Fixed pattern order in getBindingMatch. Added test
Diffstat (limited to 'configserver')
2 files changed, 26 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java index 528575f4f27..a3c17f3a89e 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java @@ -146,8 +146,8 @@ public class ApplicationHandler extends HttpHandler { "http://*/application/v2/tenant/*/application/*/environment/*/region/*/instance/*/serviceconverge/*", "http://*/application/v2/tenant/*/application/*/environment/*/region/*/instance/*/clustercontroller/*/status/*", "http://*/application/v2/tenant/*/application/*/environment/*/region/*/instance/*", - "http://*/application/v2/tenant/*/application/*", - "http://*/application/v2/tenant/*/application/*/logs"); + "http://*/application/v2/tenant/*/application/*/logs", + "http://*/application/v2/tenant/*/application/*"); } private static boolean isLogRequest(HttpRequest request) { 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 a5564d7ccf9..c8c1815bba0 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 @@ -2,6 +2,8 @@ package com.yahoo.vespa.config.server.http.v2; import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ApplicationName; @@ -32,6 +34,11 @@ import java.io.IOException; import java.net.URI; import java.time.Clock; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -176,6 +183,23 @@ public class ApplicationHandlerTest { SessionHandlerTest.getRenderedString(responseForUnknown)); } + @Test + public void testGetLogs() { + String path = "/logs?from=100&to=200"; + applicationRepository.deploy(new File("src/test/apps/app-logserver-with-container"), prepareParams(applicationId)); + WireMockServer wireMock = new WireMockServer(wireMockConfig().port(8080)); + wireMock.start(); + WireMock.configureFor("localhost", wireMock.port()); + stubFor(get(urlEqualTo(path)) + .willReturn(aResponse() + .withStatus(200))); + String url = toUrlPath(applicationId, Zone.defaultZone(), false) + path; + ApplicationHandler mockHandler = createApplicationHandler(); + HttpResponse response = mockHandler.handle(HttpRequest.createTestRequest(url, com.yahoo.jdisc.http.HttpRequest.Method.GET)); + assertEquals(200, response.getStatus()); + wireMock.stop(); + } + private void assertNotAllowed(com.yahoo.jdisc.http.HttpRequest.Method method) throws IOException { String url = "http://myhost:14000/application/v2/tenant/" + mytenantName + "/application/default"; deleteAndAssertResponse(url, Response.Status.METHOD_NOT_ALLOWED, HttpErrorResponse.errorCodes.METHOD_NOT_ALLOWED, "{\"error-code\":\"METHOD_NOT_ALLOWED\",\"message\":\"Method '" + method + "' is not supported\"}", |