(self)
| 1003 | |
| 1004 | @needs_session() |
| 1005 | def test_get_exec_summary(self): |
| 1006 | statement = "SELECT COUNT(1) FROM functional.alltypes" |
| 1007 | execute_statement_resp = self.execute_statement(statement) |
| 1008 | |
| 1009 | exec_summary_req = ImpalaHiveServer2Service.TGetExecSummaryReq() |
| 1010 | exec_summary_req.operationHandle = execute_statement_resp.operationHandle |
| 1011 | exec_summary_req.sessionHandle = self.session_handle |
| 1012 | exec_summary_resp = self.hs2_client.GetExecSummary(exec_summary_req) |
| 1013 | |
| 1014 | # Test getting the summary while query is running. We can't verify anything |
| 1015 | # about the summary (depends how much progress query has made) but the call |
| 1016 | # should work. |
| 1017 | TestHS2.check_response(exec_summary_resp) |
| 1018 | |
| 1019 | # Wait for query to start running so we can get a non-empty ExecSummary. |
| 1020 | self.wait_for_admission_control(execute_statement_resp.operationHandle) |
| 1021 | exec_summary_resp = self.hs2_client.GetExecSummary(exec_summary_req) |
| 1022 | TestHS2.check_response(exec_summary_resp) |
| 1023 | assert len(exec_summary_resp.summary.nodes) > 0 |
| 1024 | |
| 1025 | # Test that session secret is validated. Note that operation secret does not need to |
| 1026 | # be validated in addition if the session secret is valid and the operation belongs |
| 1027 | # to the session, because the user has full access to the session. |
| 1028 | TestHS2.check_invalid_session(self.hs2_client.GetExecSummary( |
| 1029 | ImpalaHiveServer2Service.TGetExecSummaryReq(execute_statement_resp.operationHandle, |
| 1030 | create_session_handle_without_secret(self.session_handle)))) |
| 1031 | |
| 1032 | # Attempt to access query with different user should fail. |
| 1033 | evil_user = getuser() + "_evil_twin" |
| 1034 | with ScopedSession(self.hs2_client, username=evil_user) as session: |
| 1035 | session_handle2 = session.sessionHandle |
| 1036 | TestHS2.check_profile_access_denied(self.hs2_client.GetExecSummary( |
| 1037 | ImpalaHiveServer2Service.TGetExecSummaryReq( |
| 1038 | execute_statement_resp.operationHandle, session_handle2)), user=evil_user) |
| 1039 | |
| 1040 | # Now close the query and verify the exec summary is available. |
| 1041 | close_operation_req = TCLIService.TCloseOperationReq() |
| 1042 | close_operation_req.operationHandle = execute_statement_resp.operationHandle |
| 1043 | TestHS2.check_response(self.hs2_client.CloseOperation(close_operation_req)) |
| 1044 | |
| 1045 | # Attempt to access query with different user from log should fail. |
| 1046 | TestHS2.check_profile_access_denied(self.hs2_client.GetRuntimeProfile( |
| 1047 | ImpalaHiveServer2Service.TGetRuntimeProfileReq( |
| 1048 | execute_statement_resp.operationHandle, session_handle2)), |
| 1049 | user=evil_user) |
| 1050 | |
| 1051 | exec_summary_resp = self.hs2_client.GetExecSummary(exec_summary_req) |
| 1052 | TestHS2.check_response(exec_summary_resp) |
| 1053 | assert len(exec_summary_resp.summary.nodes) > 0 |
| 1054 | |
| 1055 | @needs_session() |
| 1056 | def test_get_backend_config(self): |
nothing calls this directly
no test coverage detected