This is an automated email from the ASF dual-hosted git repository.

xyuanlu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new eb8d27f7f Fix CI: testPostRequestFormat::TestCustomRestClient (#2532)
eb8d27f7f is described below

commit eb8d27f7fb4f4993bf266409f45f6f151304b651
Author: Komal Desai <[email protected]>
AuthorDate: Fri Jun 23 16:06:37 2023 -0700

    Fix CI: testPostRequestFormat::TestCustomRestClient (#2532)
    
    * Fix CI: 
testPostRequestFormat(org.apache.helix.rest.client.TestCustomRestClient
    
    Test is trying to reach endpoint echobin.org which MAY not be available. So 
test only when the site is healthy.
    
    ---------
    
    Co-authored-by: Komal Desai <[email protected]>
---
 .../java/org/apache/helix/rest/client/TestCustomRestClient.java  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java
 
b/helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java
index 00c9b95e0..06015dd50 100644
--- 
a/helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java
+++ 
b/helix-rest/src/test/java/org/apache/helix/rest/client/TestCustomRestClient.java
@@ -158,11 +158,12 @@ public class TestCustomRestClient {
     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(json.get("headers").get("Accept").asText(), 
"application/json");
+      Assert.assertEquals(json.get("data").asText(), "{}");
+    }
   }
 
   @Test

Reply via email to