You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/01/11 21:43:13 UTC

impala git commit: IMPALA-7666: Propagate name of test into CLIENT_IDENTIFIER.

Repository: impala
Updated Branches:
  refs/heads/master 51f30a6b9 -> 6d5ca479f


IMPALA-7666: Propagate name of test into CLIENT_IDENTIFIER.

To facilitate correlating test failures (where we sometimes know things
like fragment id) with the tests that generated those queries, we can
stuff the test name into CLIENT_IDENTIFIER.

The mechanics here are to create a global, tests.common.current_node to
store the current test, create a plugin in conftest to set this when
entering a test, and then configuring connections as they're created
deep in test code.

Change-Id: I2f685fd16982d73ad3fc0f4a7578c5ad83b9a84c
Reviewed-on: http://gerrit.cloudera.org:8080/12177
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/6d5ca479
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/6d5ca479
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/6d5ca479

Branch: refs/heads/master
Commit: 6d5ca479f6a1fab7cb8007599663fc51b060c95e
Parents: 51f30a6
Author: Philip Zeyliger <ph...@cloudera.com>
Authored: Wed Dec 26 15:43:40 2018 -0800
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Fri Jan 11 05:34:07 2019 +0000

----------------------------------------------------------------------
 tests/common/impala_connection.py      | 15 +++++++++++++--
 tests/conftest.py                      | 11 +++++++++++
 tests/query_test/test_observability.py | 13 ++++++++++---
 3 files changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/6d5ca479/tests/common/impala_connection.py
----------------------------------------------------------------------
diff --git a/tests/common/impala_connection.py b/tests/common/impala_connection.py
index e7dace9..fbb47e5 100644
--- a/tests/common/impala_connection.py
+++ b/tests/common/impala_connection.py
@@ -24,6 +24,7 @@ import logging
 import re
 
 import impala.dbapi as impyla
+import tests.common
 from tests.beeswax.impala_beeswax import ImpalaBeeswaxClient
 
 
@@ -151,6 +152,9 @@ class BeeswaxConnection(ImpalaConnection):
 
   def clear_configuration(self):
     self.__beeswax_client.clear_query_options()
+    # A hook in conftest sets tests.common.current_node.
+    if hasattr(tests.common, "current_node"):
+      self.set_configuration_option("client_identifier", tests.common.current_node)
 
   def connect(self):
     LOG.info("-- connecting to: %s" % self.__host_port)
@@ -241,6 +245,8 @@ class ImpylaHS2Connection(ImpalaConnection):
 
   def clear_configuration(self):
     self.__query_options.clear()
+    if hasattr(tests.common, "current_node"):
+      self.set_configuration_option("client_identifier", tests.common.current_node)
 
   def connect(self):
     LOG.info("-- connecting to {0} with impyla".format(self.__host_port))
@@ -382,10 +388,15 @@ class ImpylaHS2ResultSet(object):
 
 def create_connection(host_port, use_kerberos=False, protocol='beeswax'):
   if protocol == 'beeswax':
-    return BeeswaxConnection(host_port=host_port, use_kerberos=use_kerberos)
+    c = BeeswaxConnection(host_port=host_port, use_kerberos=use_kerberos)
   else:
     assert protocol == 'hs2'
-    return ImpylaHS2Connection(host_port=host_port, use_kerberos=use_kerberos)
+    c = ImpylaHS2Connection(host_port=host_port, use_kerberos=use_kerberos)
+
+  # A hook in conftest sets tests.common.current_node.
+  if hasattr(tests.common, "current_node"):
+    c.set_configuration_option("client_identifier", tests.common.current_node)
+  return c
 
 def create_ldap_connection(host_port, user, password, use_ssl=False):
   return BeeswaxConnection(host_port=host_port, user=user, password=password,

http://git-wip-us.apache.org/repos/asf/impala/blob/6d5ca479/tests/conftest.py
----------------------------------------------------------------------
diff --git a/tests/conftest.py b/tests/conftest.py
index 0fccc5d..540bb38 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -27,6 +27,7 @@ import logging
 import os
 import pytest
 
+import tests.common
 from tests.common.environ import build_flavor_timeout
 from common.test_result_verifier import QueryTestResult
 from tests.common.patterns import is_valid_impala_identifier
@@ -590,3 +591,13 @@ def pytest_collection_modifyitems(items, config, session):
 
   logging.info("pytest shard selection enabled %s. Of %d items, selected %d items by hash.",
       config.option.shard_tests, num_items, len(items))
+
+
+@pytest.hookimpl(trylast=True)
+def pytest_runtest_logstart(nodeid, location):
+  # Beeswax doesn't support commas or equals in configuration, so they are replaced.
+  # Spaces are removed to make the string a little bit shorter.
+  # The string is shortened so that it is entirely spit out by ThriftDebugString, rather
+  # than being elided.
+  tests.common.current_node = \
+      nodeid.replace(",", ";").replace(" ", "").replace("=", "-")[0:255]

http://git-wip-us.apache.org/repos/asf/impala/blob/6d5ca479/tests/query_test/test_observability.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_observability.py b/tests/query_test/test_observability.py
index fd44b80..efdf285 100644
--- a/tests/query_test/test_observability.py
+++ b/tests/query_test/test_observability.py
@@ -186,13 +186,20 @@ class TestObservability(ImpalaTestSuite):
     profile = self.execute_query("select 1", query_opts).runtime_profile
     assert "Query Options (set by configuration): MEM_LIMIT=8589934592" in profile,\
         profile
+    assert "CLIENT_IDENTIFIER=" + \
+        "query_test/test_observability.py::TestObservability::()::test_query_options" \
+        in profile
     # For this query, the planner sets NUM_NODES=1, NUM_SCANNER_THREADS=1,
     # RUNTIME_FILTER_MODE=0 and MT_DOP=0
     expected_str = ("Query Options (set by configuration and planner): "
-        "MEM_LIMIT=8589934592,NUM_NODES=1,NUM_SCANNER_THREADS=1,"
-        "RUNTIME_FILTER_MODE=0,MT_DOP=0{erasure_coding}\n")
+        "MEM_LIMIT=8589934592,"
+        "NUM_NODES=1,NUM_SCANNER_THREADS=1,"
+        "RUNTIME_FILTER_MODE=0,MT_DOP=0,{erasure_coding}"
+        "CLIENT_IDENTIFIER="
+        "query_test/test_observability.py::TestObservability::()::test_query_options"
+        "\n")
     expected_str = expected_str.format(
-        erasure_coding=",ALLOW_ERASURE_CODED_FILES=1" if IS_EC else "")
+        erasure_coding="ALLOW_ERASURE_CODED_FILES=1," if IS_EC else "")
     assert expected_str in profile
 
   def test_exec_summary(self):