You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "rkirtir (via GitHub)" <gi...@apache.org> on 2023/04/12 10:08:44 UTC

[GitHub] [hive] rkirtir commented on a diff in pull request #4214: HIVE-23548 : TestActivePassiveHA is unstable

rkirtir commented on code in PR #4214:
URL: https://github.com/apache/hive/pull/4214#discussion_r1163919706


##########
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestActivePassiveHA.java:
##########
@@ -665,7 +666,18 @@ private String sendAuthMethod(HttpRequestBase method, boolean enableAuth, boolea
 
       httpResponse = client.execute(method);
 
-      return EntityUtils.toString(httpResponse.getEntity());
+      if (httpResponse != null) {
+        StatusLine statusLine = httpResponse.getStatusLine();
+        if (statusLine != null) {
+           response = httpResponse.getStatusLine().getReasonPhrase();
+           statusCode = httpResponse.getStatusLine().getStatusCode();
+          if (statusCode == 200) {
+            return EntityUtils.toString(httpResponse.getEntity());
+          }

Review Comment:
   Only HTTP 200 contains response body other than this there is no/empty response body. If we do not handle this 
   testManualFailoverUnauthorized() method  fails at   assertTrue(sendDelete(url1, false).contains("Unauthorized"));
   as it tries to get "Unauthorized" string from response body



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org