You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2023/02/28 17:12:48 UTC

[impala] 01/06: IMPALA-10111: Fix TestWebPage::test_query_stmt flakiness

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

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

commit 2ae0e4139c2a9cd07e32bae29a256ecc8f8424c0
Author: Gergely Fürnstáhl <gf...@cloudera.com>
AuthorDate: Tue Feb 21 11:39:11 2023 +0100

    IMPALA-10111: Fix TestWebPage::test_query_stmt flakiness
    
    A query might be logged in "in_flight_queries" even though it has
    already finished. Earlier the test only looked for the executed query
    in "completed_queries", after this commit it will look in both lists.
    
    Moreover, removed unnecessary duplicated execution of the query and
    added formatting to dumped response to ease debugging in the future.
    
    Testing:
     - Locally reproducible for the first test run after starting the
    cluster.
     - Verified that the query is found in in_flight_queries too and the
    test passes in this case.
    
    Change-Id: If25d430a871415a3884dece772b8d8105c583c05
    Reviewed-on: http://gerrit.cloudera.org:8080/19524
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 tests/webserver/test_web_pages.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/webserver/test_web_pages.py b/tests/webserver/test_web_pages.py
index d0efd220d..544e8c3d3 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -492,15 +492,18 @@ class TestWebPage(ImpalaTestSuite):
     # chars + "..."
     expected_result = "select \"{0}...".format("x " * 121)
     check_if_contains = False
-    self.execute_query(query)
-    response_json = self.__run_query_and_get_debug_page(query, self.QUERIES_URL)
+    response_json = self.__run_query_and_get_debug_page(
+      query, self.QUERIES_URL, expected_state=self.client.QUERY_STATES["FINISHED"])
     # Search the json for the expected value.
-    for json_part in response_json['completed_queries']:
+    # The query can be in in_filght_queries even though it is in FINISHED state.
+    for json_part in itertools.chain(
+      response_json['completed_queries'], response_json['in_flight_queries']):
       if expected_result in json_part['stmt']:
         check_if_contains = True
         break
+
     assert check_if_contains, "No matching statement found in the jsons at {}: {}".format(
-        datetime.now(), response_json)
+        datetime.now(), json.dumps(response_json, sort_keys=True, indent=4))
 
   def __run_query_and_get_debug_page(self, query, page_url, query_options=None,
                                      expected_state=None):