You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2023/11/01 19:57:44 UTC

(pinot) branch master updated: Fix flaky OfflineClusterIntegrationTest on server response size tests (#11926)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 168d630a05 Fix flaky OfflineClusterIntegrationTest on server response size tests (#11926)
168d630a05 is described below

commit 168d630a05126922a658f3543d0595b06ec5bd04
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Wed Nov 1 12:57:38 2023 -0700

    Fix flaky OfflineClusterIntegrationTest on server response size tests (#11926)
---
 .../tests/OfflineClusterIntegrationTest.java       | 80 +++++++++-------------
 1 file changed, 32 insertions(+), 48 deletions(-)

diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
index d9e61c9dd4..68c36234b2 100644
--- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
+++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
@@ -626,9 +626,10 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
       throws Exception {
     String queryWithOption = "SET maxServerResponseSizeBytes=1000; " + SELECT_STAR_QUERY;
     JsonNode response = postQuery(queryWithOption);
-    assert response.get("exceptions").size() > 0;
-    int errorCode = response.get("exceptions").get(0).get("errorCode").asInt();
-    assertEquals(errorCode, 503);
+    JsonNode exceptions = response.get("exceptions");
+    assertFalse(exceptions.isEmpty());
+    int errorCode = exceptions.get(0).get("errorCode").asInt();
+    assertEquals(errorCode, QueryException.QUERY_CANCELLATION_ERROR_CODE);
   }
 
   @Test
@@ -636,9 +637,10 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
       throws Exception {
     String queryWithOption = "SET maxQueryResponseSizeBytes=1000; " + SELECT_STAR_QUERY;
     JsonNode response = postQuery(queryWithOption);
-    assert response.get("exceptions").size() > 0;
-    int errorCode = response.get("exceptions").get(0).get("errorCode").asInt();
-    assertEquals(errorCode, 503);
+    JsonNode exceptions = response.get("exceptions");
+    assertFalse(exceptions.isEmpty());
+    int errorCode = exceptions.get(0).get("errorCode").asInt();
+    assertEquals(errorCode, QueryException.QUERY_CANCELLATION_ERROR_CODE);
   }
 
   @Test
@@ -649,16 +651,13 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should return an exception
+        // Server should return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        assert response.get("exceptions").size() > 0;
-        int errorCode = response.get("exceptions").get(0).get("errorCode").asInt();
-        if (errorCode == 503) {
-          return true;
-        }
-        return false;
+        JsonNode exceptions = response.get("exceptions");
+        return !exceptions.isEmpty()
+            && exceptions.get(0).get("errorCode").asInt() == QueryException.QUERY_CANCELLATION_ERROR_CODE;
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
 
@@ -667,14 +666,11 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should not return an exception
+        // Server should not return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        if (response.get("exceptions").size() == 0) {
-          return true;
-        }
-        return false;
+        return response.get("exceptions").isEmpty();
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
   }
@@ -687,16 +683,13 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should return an exception
+        // Server should return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        assert response.get("exceptions").size() > 0;
-        int errorCode = response.get("exceptions").get(0).get("errorCode").asInt();
-        if (errorCode == 503) {
-          return true;
-        }
-        return false;
+        JsonNode exceptions = response.get("exceptions");
+        return !exceptions.isEmpty()
+            && exceptions.get(0).get("errorCode").asInt() == QueryException.QUERY_CANCELLATION_ERROR_CODE;
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
 
@@ -705,14 +698,11 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should not return an exception
+        // Server should not return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        if (response.get("exceptions").size() == 0) {
-          return true;
-        }
-        return false;
+        return response.get("exceptions").isEmpty();
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
   }
@@ -725,16 +715,13 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should return an exception
+        // Server should return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        assert response.get("exceptions").size() > 0;
-        int errorCode = response.get("exceptions").get(0).get("errorCode").asInt();
-        if (errorCode == 503) {
-          return true;
-        }
-        return false;
+        JsonNode exceptions = response.get("exceptions");
+        return !exceptions.isEmpty()
+            && exceptions.get(0).get("errorCode").asInt() == QueryException.QUERY_CANCELLATION_ERROR_CODE;
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
 
@@ -743,14 +730,11 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
 
     TestUtils.waitForCondition(aVoid -> {
       try {
-        // Server should not return an exception
+        // Server should not return exception after the table config is picked up
         JsonNode response = postQuery(SELECT_STAR_QUERY);
-        if (response.get("exceptions").size() == 0) {
-          return true;
-        }
-        return false;
+        return response.get("exceptions").isEmpty();
       } catch (Exception e) {
-        return false;
+        throw new RuntimeException(e);
       }
     }, 60_000L, "Failed to execute query");
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org