This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 7a1f4b671395a567c89e2cd3561d8560df22f7e6 Author: jasonmfehr <[email protected]> AuthorDate: Wed Feb 26 14:40:51 2025 -0800 IMPALA-13671: Add Additional Debug Output The custom_cluster/test_workload_mgmt_init.py tests failed with a mismatch between the expected and actual start time. The error that is logged only says "start time incorrect". This patch adds the expected and actual query start time values to the assertion failed message. Testing accomplished by the following test suites passing locally: * tests/custom_cluster/test_query_live.py * tests/custom_cluster/test_query_log.py * tests/custom_cluster/test_workload_mgmt_init.py * tests/custom_cluster/test_workload_mgmt_sql_details.py Change-Id: Ieb1627ea719f0e20459ba6052685320a169d5176 Reviewed-on: http://gerrit.cloudera.org:8080/22555 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- tests/util/workload_management.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/util/workload_management.py b/tests/util/workload_management.py index 3a8a7c5b7..5053a2a2c 100644 --- a/tests/util/workload_management.py +++ b/tests/util/workload_management.py @@ -34,10 +34,14 @@ QUERY_TBL_LOG_NAME = "impala_query_log" QUERY_TBL_LOG = "{0}.{1}".format(WM_DB, QUERY_TBL_LOG_NAME) QUERY_TBL_LIVE_NAME = "impala_query_live" QUERY_TBL_LIVE = "{0}.{1}".format(WM_DB, QUERY_TBL_LIVE_NAME) + # Time in seconds the assert_query and assert_csv_col will wait for the query to become # available in the relevant workload management table. ASSERT_QUERY_TIMEOUT_S = 30 +# String parsing format for query start/end time fields in a text query profile. +QUERY_PROFILE_DT_FORMAT = "%Y-%m-%d %H:%M:%S.%f" + def round_to_3(val): # The differences between round in Python 2 and Python 3 do not matter here. @@ -216,15 +220,17 @@ def assert_query(query_tbl, client, expected_cluster_id="", raw_profile=None, # Start Time start_time = re.search(r'\n\s+Start Time:\s+(.*?)\n', profile_text) assert start_time is not None - start_time_obj = datetime.strptime(start_time.group(1)[:-3], "%Y-%m-%d %H:%M:%S.%f") + start_time_obj = datetime.strptime(start_time.group(1)[:-3], QUERY_PROFILE_DT_FORMAT) start_time_obj_utc = start_time_obj + utc_offset - assert column_val(TQueryTableColumn.START_TIME_UTC)[:-3] \ - == start_time_obj_utc.strftime("%Y-%m-%d %H:%M:%S.%f"), "start time incorrect" + expected = start_time_obj_utc.strftime(QUERY_PROFILE_DT_FORMAT) + actual = column_val(TQueryTableColumn.START_TIME_UTC)[:-3] + assert actual == expected, "start time incorrect, expected '{}' but was '{}'" \ + .format(expected, actual) # End Time (not in table, but needed for duration calculation) end_time = re.search(r'\n\s+End Time:\s+(.*?)\n', profile_text) assert end_time is not None - end_time_obj = datetime.strptime(end_time.group(1)[:-3], "%Y-%m-%d %H:%M:%S.%f") + end_time_obj = datetime.strptime(end_time.group(1)[:-3], QUERY_PROFILE_DT_FORMAT) # Query Duration (allow values that are within 1 second) value = column_val(TQueryTableColumn.TOTAL_TIME_MS)
