mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-8515: port shell tests to use shell build
shell/make_shell_tarball.sh builds a tarball with all the shell dependencies bundled. We should test the contents of that tarball in the shell tests instead of using infra/python/env and the libraries bundled there. This tarball is one of the default targets (e.g. run by buildall.sh) so this should not affect any typical development workflows. Note that this means the shell tests now requires the shell tarball to be built locally, which doesn't necessarily happen for remote cluster tests, so we preserve the old behaviour in that case. Testing: Ran core tests on CentOS 6 and CentOS 7. Change-Id: I581363639b279a9c2ff1fd982bdb140260b24baa Reviewed-on: http://gerrit.cloudera.org:8080/13267 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
committed by
Impala Public Jenkins
parent
cc78b764e8
commit
b55d905322
@@ -25,8 +25,23 @@ import shlex
|
||||
import time
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from tests.common.environ import (IMPALA_LOCAL_BUILD_VERSION,
|
||||
IMPALA_TEST_CLUSTER_PROPERTIES)
|
||||
from tests.common.impala_test_suite import IMPALAD_BEESWAX_HOST_PORT
|
||||
|
||||
|
||||
SHELL_HISTORY_FILE = os.path.expanduser("~/.impalahistory")
|
||||
IMPALA_HOME = os.environ['IMPALA_HOME']
|
||||
|
||||
if IMPALA_TEST_CLUSTER_PROPERTIES.is_remote_cluster():
|
||||
# With remote cluster testing, we cannot assume that the shell was built locally.
|
||||
IMPALA_SHELL_EXECUTABLE = os.path.join(IMPALA_HOME, "bin/impala-shell.sh")
|
||||
else:
|
||||
# Test the locally built shell distribution.
|
||||
IMPALA_SHELL_EXECUTABLE = os.path.join(
|
||||
IMPALA_HOME, "shell/build", "impala-shell-" + IMPALA_LOCAL_BUILD_VERSION,
|
||||
"impala-shell")
|
||||
|
||||
|
||||
def assert_var_substitution(result):
|
||||
assert_pattern(r'\bfoo_number=.*$', 'foo_number= 123123', result.stdout, \
|
||||
@@ -129,8 +144,10 @@ def get_impalad_port(vector):
|
||||
def get_shell_cmd(vector):
|
||||
"""Get the basic shell command to start the shell, given the provided test vector.
|
||||
Returns the command as a list of string arguments."""
|
||||
return [os.path.join(os.environ['IMPALA_HOME'], "bin/impala-shell.sh"),
|
||||
"-i{0}".format(get_impalad_host_port(vector))]
|
||||
# Use impala-shell build instead of bin/impala-shell.sh so that we test with the
|
||||
# system python, not the toolchain python and in a configuration close to what
|
||||
# we will distribute.
|
||||
return [IMPALA_SHELL_EXECUTABLE, "-i{0}".format(get_impalad_host_port(vector))]
|
||||
|
||||
|
||||
def get_open_sessions_metric(vector):
|
||||
@@ -206,5 +223,10 @@ class ImpalaShell(object):
|
||||
cmd = get_shell_cmd(vector)
|
||||
if args is not None: cmd += args
|
||||
if not env: env = os.environ
|
||||
# Don't inherit PYTHONPATH - the shell launch script should set up PYTHONPATH
|
||||
# to include dependencies. Copy 'env' to avoid mutating argument or os.environ.
|
||||
env = dict(env)
|
||||
if "PYTHONPATH" in env:
|
||||
del env["PYTHONPATH"]
|
||||
return Popen(cmd, shell=False, stdout=PIPE, stdin=PIPE, stderr=PIPE,
|
||||
env=env)
|
||||
|
||||
Reference in New Issue
Block a user