def get_log(self, query_stmt): execute_statement_resp = self.execute_statement(query_stmt) # Fetch results to make sure errors are generated. Errors are only guaranteed to be # seen by the coordinator after FetchResults() returns eos. has_more_results = True while has_more_results: fetch_results_req = TCLIService.TFetchResultsReq() fetch_results_req.operationHandle = execute_statement_resp.operationHandle fetch_results_req.maxRows = 100 fetch_results_resp = self.hs2_client.FetchResults( fetch_results_req) TestHS2.check_response(fetch_results_resp) has_more_results = fetch_results_resp.hasMoreRows # Test that secret is validated. invalid_get_log_req = TCLIService.TGetLogReq() invalid_get_log_req.operationHandle = create_op_handle_without_secret( execute_statement_resp.operationHandle) TestHS2.check_invalid_query( self.hs2_client.GetLog(invalid_get_log_req), expect_legacy_err=True) get_log_req = TCLIService.TGetLogReq() get_log_req.operationHandle = execute_statement_resp.operationHandle get_log_resp = self.hs2_client.GetLog(get_log_req) TestHS2.check_response(get_log_resp) return get_log_resp.log
def get_log(self, query_stmt): execute_statement_req = TCLIService.TExecuteStatementReq() execute_statement_req.sessionHandle = self.session_handle execute_statement_req.statement = query_stmt execute_statement_resp = self.hs2_client.ExecuteStatement( execute_statement_req) TestHS2.check_response(execute_statement_resp) # Fetch results to make sure errors are generated. Errors are only guaranteed to be # seen by the coordinator after FetchResults() returns eos. has_more_results = True while has_more_results: fetch_results_req = TCLIService.TFetchResultsReq() fetch_results_req.operationHandle = execute_statement_resp.operationHandle fetch_results_req.maxRows = 100 fetch_results_resp = self.hs2_client.FetchResults( fetch_results_req) TestHS2.check_response(fetch_results_resp) has_more_results = fetch_results_resp.hasMoreRows get_log_req = TCLIService.TGetLogReq() get_log_req.operationHandle = execute_statement_resp.operationHandle get_log_resp = self.hs2_client.GetLog(get_log_req) TestHS2.check_response(get_log_resp) return get_log_resp.log
def wait_for_log_message(self, operationHandle, expected_message, timeout=10): start_time = time() while (time() - start_time < timeout): get_log_req = TCLIService.TGetLogReq() get_log_req.operationHandle = operationHandle log = self.hs2_client.GetLog(get_log_req).log if expected_message in log: return log sleep(0.05) assert False, "Did not find expected log message '%s' in time, latest log: '%s'" \ % (expected_message, log)
def get_log(self, query_stmt): execute_statement_req = TCLIService.TExecuteStatementReq() execute_statement_req.sessionHandle = self.session_handle execute_statement_req.statement = query_stmt execute_statement_resp = self.hs2_client.ExecuteStatement(execute_statement_req) TestHS2.check_response(execute_statement_resp) # Fetch results to make sure errors are generated fetch_results_req = TCLIService.TFetchResultsReq() fetch_results_req.operationHandle = execute_statement_resp.operationHandle fetch_results_req.maxRows = 100 fetch_results_resp = self.hs2_client.FetchResults(fetch_results_req) TestHS2.check_response(fetch_results_resp) get_log_req = TCLIService.TGetLogReq() get_log_req.operationHandle = execute_statement_resp.operationHandle get_log_resp = self.hs2_client.GetLog(get_log_req) TestHS2.check_response(get_log_resp) return get_log_resp.log