You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "desaikomal (via GitHub)" <gi...@apache.org> on 2023/06/17 03:05:29 UTC

[GitHub] [helix] desaikomal commented on a diff in pull request #2532: Fix CI: testPostRequestFormat::TestCustomRestClient

desaikomal commented on code in PR #2532:
URL: https://github.com/apache/helix/pull/2532#discussion_r1232941199


##########
helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java:
##########
@@ -158,11 +158,13 @@ public void testPostRequestFormat() throws IOException {
     final String echoServer = "http://httpbin.org/post";
     CustomRestClientImpl customRestClient = new CustomRestClientImpl(HttpClients.createDefault());
     HttpResponse response = customRestClient.post(echoServer, Collections.emptyMap());
-    JsonNode json = customRestClient.getJsonObject(response);
+    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+      JsonNode json = customRestClient.getJsonObject(response);
 
-    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
-    Assert.assertEquals(json.get("headers").get("Accept").asText(), "application/json");
-    Assert.assertEquals(json.get("data").asText(), "{}");
+      Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);

Review Comment:
   true, it is redundant. I was wondering if there is a better way to detect if the endpoint is accessible? i couldn't find any other way. do you have any suggestion?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org