diff options
author | Øyvind Grønnesby <oyving@verizonmedia.com> | 2020-10-19 14:01:41 +0200 |
---|---|---|
committer | Øyvind Grønnesby <oyving@verizonmedia.com> | 2020-10-19 14:01:41 +0200 |
commit | 84407d75bd006e1fc432a5b915e4f999c164aed4 (patch) | |
tree | 534a1eac0b57f38a2a3b5c7411e6cbfc35ad6e1c /configserver | |
parent | 93dab00e78bc0e841f073625d02aec68f81a0cbf (diff) |
Fix quota request matcher
Diffstat (limited to 'configserver')
2 files changed, 18 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 59523a28b33..01d0938a9b0 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 @@ -274,8 +274,8 @@ public class ApplicationHandler extends HttpHandler { } private static boolean isQuotaUsageRequest(HttpRequest request) { - return getBindingMatch(request).groupCount() > 7 && - request.getUri().getPath().contains("/quota"); + return getBindingMatch(request).groupCount() == 7 && + request.getUri().getPath().endsWith("/quota"); } private static String getHostNameFromRequest(HttpRequest req) { 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 d94afb498a1..7276091fed0 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 @@ -178,6 +178,22 @@ public class ApplicationHandlerTest { } @Test + public void testGetQuota() throws Exception { + PrepareParams prepareParams = new PrepareParams.Builder() + .applicationId(applicationId) + .vespaVersion(vespaVersion) + .build(); + applicationRepository.deploy(testApp, prepareParams).sessionId(); + + var url = toUrlPath(applicationId, Zone.defaultZone(), true) + "/quota"; + var response = createApplicationHandler().handle(HttpRequest.createTestRequest(url, GET)); + assertEquals(200, response.getStatus()); + var renderedString = SessionHandlerTest.getRenderedString(response); + + assertEquals("{\"rate\":0.0}", renderedString); + } + + @Test public void testRestart() throws Exception { applicationRepository.deploy(testApp, prepareParams(applicationId)); assertFalse(provisioner.restarted()); |