[
https://issues.apache.org/jira/browse/FLINK-7663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16181144#comment-16181144
]
ASF GitHub Bot commented on FLINK-7663:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/4699#discussion_r141118884
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestEndpointITCase.java
---
@@ -86,46 +98,97 @@ public void testEndpoints() throws Exception {
mockGatewayRetriever,
RpcUtils.INF_TIMEOUT);
- RestServerEndpoint serverEndpoint = new
TestRestServerEndpoint(serverConfig, testHandler);
- RestClient clientEndpoint = new TestRestClient(clientConfig);
+ serverEndpoint = new TestRestServerEndpoint(serverConfig,
testHandler);
+ clientEndpoint = new TestRestClient(clientConfig);
- try {
- serverEndpoint.start();
-
- TestParameters parameters = new TestParameters();
- parameters.jobIDPathParameter.resolve(PATH_JOB_ID);
-
parameters.jobIDQueryParameter.resolve(Collections.singletonList(QUERY_JOB_ID));
-
- // send first request and wait until the handler blocks
- CompletableFuture<TestResponse> response1;
- synchronized (TestHandler.LOCK) {
- response1 = clientEndpoint.sendRequest(
- serverConfig.getEndpointBindAddress(),
- serverConfig.getEndpointBindPort(),
- new TestHeaders(),
- parameters,
- new TestRequest(1));
- TestHandler.LOCK.wait();
- }
+ serverEndpoint.start();
+ }
+
+ @After
+ public void teardown() {
+ if (clientEndpoint != null) {
+ clientEndpoint.shutdown(timeout);
+ clientEndpoint = null;
+ }
- // send second request and verify response
- CompletableFuture<TestResponse> response2 =
clientEndpoint.sendRequest(
- serverConfig.getEndpointBindAddress(),
- serverConfig.getEndpointBindPort(),
+ if (serverEndpoint != null) {
+ serverEndpoint.shutdown(timeout);
+ serverEndpoint = null;
+ }
+ }
+
+ @Test
+ public void testEndpoints() throws Exception {
--- End diff --
rename to "testRequestInterleaving", since we modify the line anyway
> Allow AbstractRestHandler to handle bad requests
> ------------------------------------------------
>
> Key: FLINK-7663
> URL: https://issues.apache.org/jira/browse/FLINK-7663
> Project: Flink
> Issue Type: Bug
> Components: REST
> Affects Versions: 1.4.0
> Reporter: Till Rohrmann
> Assignee: Till Rohrmann
> Labels: flip-6
>
> The {{AbstractRestHandler}} parses the request and tries to generate a
> {{HandlerRequest}}. If this fails, then the server answers with an internal
> server error. Instead we should allow the {{AbstractRestHandler}} to be able
> to return a BAD_REQUEST status code. In order to do that, I would like to
> introduce a {{HandlerRequestException}} which can be thrown while creating
> the {{HandlerRequest}}. If this exception is thrown, then we return an error
> message with {{BAD_REQUEST}} {{HttpResponseStatus}}.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)