zentol commented on a change in pull request #7295: [FLINK-10748] Decouple
RestServerEndpoint from Dispatcher
URL: https://github.com/apache/flink/pull/7295#discussion_r241388291
##########
File path:
flink-runtime-web/src/test/java/org/apache/flink/runtime/webmonitor/LeaderRetrievalHandlerTest.java
##########
@@ -101,31 +87,14 @@ public void testRedirectHandler() throws Exception {
configuration);
try (HttpTestClient httpClient = new
HttpTestClient("localhost", bootstrap.getServerPort())) {
- // 1. without completed local address future -->
Internal server error
+ // 1. no leader gateway available --> Service
unavailable
httpClient.sendGetRequest(restPath,
FutureUtils.toFiniteDuration(timeout));
HttpTestClient.SimpleHttpResponse response =
httpClient.getNextResponse(FutureUtils.toFiniteDuration(timeout));
-
Assert.assertEquals(HttpResponseStatus.INTERNAL_SERVER_ERROR,
response.getStatus());
-
- // 2. with completed local address future but no leader
gateway available --> Service unavailable
- localAddressFuture.complete(correctAddress);
-
- httpClient.sendGetRequest(restPath,
FutureUtils.toFiniteDuration(timeout));
-
- response =
httpClient.getNextResponse(FutureUtils.toFiniteDuration(timeout));
-
Assert.assertEquals(HttpResponseStatus.SERVICE_UNAVAILABLE,
response.getStatus());
- // 3. with leader gateway which is not the one of this
REST endpoints --> Redirection required
- httpClient.sendGetRequest(restPath,
FutureUtils.toFiniteDuration(timeout));
-
- response =
httpClient.getNextResponse(FutureUtils.toFiniteDuration(timeout));
-
-
Assert.assertEquals(HttpResponseStatus.TEMPORARY_REDIRECT,
response.getStatus());
- Assert.assertEquals(expectedRedirection,
response.getLocation());
-
- // 4. with local REST endpoint
+ // 2. with leader
Review comment:
oh i get that, but this test only executes
```
httpClient.sendGetRequest(restPath, FutureUtils.toFiniteDuration(timeout));
HttpTestClient.SimpleHttpResponse response =
httpClient.getNextResponse(FutureUtils.toFiniteDuration(timeout));
```
twice, with each getting a different response. What causes the response to
be different? I don't see any modifications being made to the state of the rest
server / futures between the 2 requests. This isn't just a timing thing, is it?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services