aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-21 17:41:07 +0200
committerTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-25 16:05:23 +0200
commit8c6befb4a9fb5357d33208631cc15989dab771f7 (patch)
tree9501dda9ae920968e0a109a0922a45b3833c16aa /clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java
parentdebb34547c76429e8a345299e4765824903f784c (diff)
Add configurable deadline for cluster controller tasks
Prevents an unstable cluster from potentially holding up all container request processing threads indefinitely. Deadline errors are translated into HTTP 504 errors to REST API clients.
Diffstat (limited to 'clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java')
-rw-r--r--clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java
index 8328ecc491f..3492c632e60 100644
--- a/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java
+++ b/clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/staterestapi/StateRestAPITest.java
@@ -526,4 +526,17 @@ public class StateRestAPITest {
} catch (IllegalArgumentException e) {
}
}
+
+ @Test
+ public void deadline_exceeded_exception_returns_http_504_error() throws Exception {
+ setupDummyStateApi();
+ stateApi.induceException(new DeadlineExceededException("argh!"));
+ HttpResult result = execute(new HttpRequest().setPath("/cluster/v2"));
+
+ assertEquals(result.toString(true), 504, result.getHttpReturnCode());
+ assertEquals(result.toString(true), "Gateway Timeout", result.getHttpReturnCodeDescription());
+ assertEquals(result.toString(true), "application/json", result.getHeader("Content-Type"));
+ String expected = "{\"message\":\"argh!\"}";
+ assertEquals(expected, result.getContent().toString());
+ }
}