summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorØyvind Grønnesby <oyving@verizonmedia.com>2020-10-19 14:26:05 +0200
committerGitHub <noreply@github.com>2020-10-19 14:26:05 +0200
commit03b00764a060e424b5c2ff9ea5818d0e5303cd33 (patch)
tree7e6216c14fae09e891119d487772ddf465717a67 /configserver
parentd89ed150a29a758c6e26d8422b7ad69fec4253a1 (diff)
parent84407d75bd006e1fc432a5b915e4f999c164aed4 (diff)
Merge pull request #14947 from vespa-engine/ogronnesby/fix-quota-request-matcher
Fix quota request matcher
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java4
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java16
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 9f7bbb689ea..e55a36af386 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
@@ -174,6 +174,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());