Skip to content

Commit 181fd94

Browse files
MikaelSmithjoemcdonnell
authored andcommitted
IMPALA-8373: Test impala-shell with python3
Sets up a python3 virtualenv, installs impala-shell into it, and runs tests. Change-Id: I8e123aecd53a7ded44a7da7eb8c8b853cebbfc56 Reviewed-on: http://gerrit.cloudera.org:8080/18588 Reviewed-by: Joe McDonnell <[email protected]> Tested-by: Joe McDonnell <[email protected]>
1 parent 5263d13 commit 181fd94

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,10 @@ add_custom_target(impala_python ALL
467467
COMMAND "${CMAKE_SOURCE_DIR}/bin/init-impala-python.sh"
468468
)
469469

470+
add_custom_target(impala_shell_pypi ALL DEPENDS shell_python2_install shell_python3_install)
471+
470472
add_custom_target(notests_independent_targets DEPENDS
471-
java cscope tarballs impala_python shell_python2_install
473+
java cscope tarballs impala_python impala_shell_pypi
472474
)
473475
add_custom_target(notests_regular_targets DEPENDS
474476
impalad statestored catalogd admissiond fesupport loggingsupport ImpalaUdf udasample udfsample impala-profile-tool

bin/bootstrap_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set -euxo pipefail
3232
# Install non-java dependencies:
3333
sudo apt-get update
3434
sudo apt-get --yes install g++ gcc git libsasl2-dev libssl-dev make \
35-
python-dev python-setuptools libffi-dev libkrb5-dev
35+
python-dev python-setuptools python3-dev libffi-dev libkrb5-dev
3636

3737

3838
source /etc/lsb-release

bin/bootstrap_system.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ ubuntu apt-get update
218218
ubuntu apt-get --yes install ccache curl gawk g++ gcc libffi-dev \
219219
libkrb5-dev krb5-admin-server krb5-kdc krb5-user libsasl2-dev \
220220
libsasl2-modules libsasl2-modules-gssapi-mit libssl-dev make ninja-build \
221-
python-dev python-setuptools postgresql ssh wget vim-common psmisc \
221+
python-dev python-setuptools python3-dev postgresql ssh wget vim-common psmisc \
222222
lsof openjdk-8-jdk openjdk-8-source openjdk-8-dbg apt-utils git ant
223223
# Required by Kudu in the minicluster
224224
ubuntu20 apt-get --yes install libtinfo5
@@ -266,7 +266,7 @@ redhat sudo yum install -y curl gawk gcc gcc-c++ git krb5-devel krb5-server \
266266
postgresql postgresql-server \
267267
wget vim-common nscd cmake fuse-devel zlib-devel \
268268
psmisc lsof openssh-server redhat-lsb java-1.8.0-openjdk-devel \
269-
java-1.8.0-openjdk-src
269+
java-1.8.0-openjdk-src python3-devel
270270

271271
# Enable the Powertools repo for snappy-devel on RedHat 8
272272
redhat8 sudo yum install -y dnf-plugins-core

shell/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,20 @@ add_custom_target(shell_pypi_test_package DEPENDS shell_tarball
3535
)
3636

3737
set(PYTHON2_VENV "${CMAKE_SOURCE_DIR}/shell/build/py2_venv")
38+
set(PYTHON3_VENV "${CMAKE_SOURCE_DIR}/shell/build/py3_venv")
3839

3940
add_custom_command(OUTPUT "${PYTHON2_VENV}" DEPENDS impala_python
4041
COMMAND impala-virtualenv --python python2 "${PYTHON2_VENV}"
4142
)
4243

43-
add_custom_target(shell_python2_install ALL DEPENDS "${PYTHON2_VENV}" shell_pypi_test_package
44+
add_custom_target(shell_python2_install DEPENDS "${PYTHON2_VENV}" shell_pypi_test_package
4445
COMMAND "${PYTHON2_VENV}/bin/pip" install "${SHELL_TEST_PKG}"
4546
)
47+
48+
add_custom_command(OUTPUT "${PYTHON3_VENV}" DEPENDS impala_python
49+
COMMAND impala-virtualenv --python python3 "${PYTHON3_VENV}"
50+
)
51+
52+
add_custom_target(shell_python3_install DEPENDS "${PYTHON3_VENV}" shell_pypi_test_package
53+
COMMAND "${PYTHON3_VENV}/bin/pip" install "${SHELL_TEST_PKG}"
54+
)

tests/shell/test_shell_commandline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def add_test_dimensions(cls):
145145
cls.ImpalaTestMatrix.add_dimension(create_client_protocol_strict_dimension())
146146
cls.ImpalaTestMatrix.add_constraint(lambda v:
147147
v.get_value('protocol') != 'beeswax' or not v.get_value('strict_hs2_protocol'))
148-
# Test with python2 and the raw tarball
148+
# Test with python2, python3, and the raw tarball
149149
cls.ImpalaTestMatrix.add_dimension(create_impala_shell_executable_dimension())
150150

151151
def test_no_args(self, vector):

tests/shell/test_shell_interactive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def add_test_dimensions(cls):
176176
cls.ImpalaTestMatrix.add_dimension(create_client_protocol_strict_dimension())
177177
cls.ImpalaTestMatrix.add_constraint(lambda v:
178178
v.get_value('protocol') != 'beeswax' or not v.get_value('strict_hs2_protocol'))
179-
# Test with python2 and the raw tarball
179+
# Test with python2, python3, and the raw tarball
180180
cls.ImpalaTestMatrix.add_dimension(create_impala_shell_executable_dimension())
181181

182182
def _expect_with_cmd(self, proc, cmd, vector, expectations=(), db="default"):

tests/shell/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def get_dev_impala_shell_executable():
324324
def create_impala_shell_executable_dimension():
325325
_, include_pypi = get_dev_impala_shell_executable()
326326
if include_pypi:
327-
return ImpalaTestDimension('impala_shell', 'dev', 'python2')
327+
return ImpalaTestDimension('impala_shell', 'dev', 'python2', 'python3')
328328
else:
329329
return ImpalaTestDimension('impala_shell', 'dev')
330330

@@ -335,5 +335,6 @@ def get_impala_shell_executable(vector):
335335
impala_shell_executable, _ = get_dev_impala_shell_executable()
336336
return {
337337
'dev': impala_shell_executable,
338-
'python2': os.path.join(IMPALA_HOME, 'shell/build/py2_venv/bin/impala-shell')
338+
'python2': os.path.join(IMPALA_HOME, 'shell/build/py2_venv/bin/impala-shell'),
339+
'python3': os.path.join(IMPALA_HOME, 'shell/build/py3_venv/bin/impala-shell')
339340
}[vector.get_value_with_default('impala_shell', 'dev')]

0 commit comments

Comments
 (0)