def assert_query_profile_contains(self, query_id, search): ''' Asserts that the query profile for 'query_id' contains 'search' string''' impala_service = self.create_impala_service() url = 'query_profile?query_id=%s' % query_id results = grep_file(impala_service.open_debug_webpage(url), search) assert results, "Query profile %s should contain '%s' but does not" \ % (url, search)
def assert_server_fails_to_start(self, rules, start_options, expected_error_message): try: self.start_cluster_using_rules(rules, **start_options) self.fail('Cluster should not have started but did') except Exception: if self.cluster.impalads: raise Exception("No impalads should have started") with open(os.path.join(self.log_dir, 'impalad-out.log')) as file: result = grep_file(file, expected_error_message) assert result, 'The expected error message was not found'
def assert_web_ui_contains(self, query_id, search): '''Asserts that the 'search' term is present in all the pages that show user queries. ''' impala_service = self.create_impala_service() for page in ('queries', 'query_stmt', 'query_plan_text', 'query_profile'): url = '%s?query_id=%s' % (page, query_id) results = grep_file(impala_service.open_debug_webpage(url), search) assert results, "Web page %s should contain '%s' but does not" \ % (url, search)
def assert_web_ui_redaction(self, query_id, unredacted_value, redacted_value): '''Asserts that the 'unredacted_value' is not present but the 'redacted_value' is.''' impala_service = self.create_impala_service() # The web ui should not show the unredacted value. for page in ('queries', 'query_stmt', 'query_plan_text', 'query_summary', 'query_profile', 'query_plan'): for response_format in ('html', 'json'): # The 'html' param is actually ignored by the server. url = page + '?query_id=' + query_id + "&" + response_format results = grep_file(impala_service.open_debug_webpage(url), unredacted_value) assert not results, "Web page %s should not contain '%s' but does" \ % (url, unredacted_value) # But the redacted value should be shown. self.assert_web_ui_contains(query_id, redacted_value)