IMPALA-7945: Fix test_hdfs_timeout.py on python 2.6

test_hdfs_timeout.py used subprocess.check_output. This function
does not exist on python 2.6; it was introduced in python 2.7.

This switches test_hdfs_timeout.py to use exec_process() from
tests.util.shell_util.

Change-Id: Ifde02778dfe74c5e7f56c6ae08cd0114bc3d3dca
Reviewed-on: http://gerrit.cloudera.org:8080/12059
Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Joe McDonnell
2018-12-09 17:28:05 -08:00
parent 24445d5bf1
commit ecf12bec42

View File

@@ -21,7 +21,8 @@ import time
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
from tests.common.skip import SkipIfNotHdfsMinicluster
from subprocess import check_call, check_output
from subprocess import check_call
from tests.util.shell_util import exec_process
@SkipIfNotHdfsMinicluster.tuned_for_minicluster
@@ -42,7 +43,9 @@ class TestHdfsTimeouts(CustomClusterTestSuite):
# Find the NameNode's pid via pgrep. This would raise an error if it did not
# find a pid, so there is at least one match.
pgrep_output = check_output(["pgrep", "-f", "namenode.NameNode"])
rc, pgrep_output, stderr = exec_process("pgrep -f namenode.NameNode")
assert rc == 0, \
"Error finding NameNode pid\nstdout={0}\nstderr={1}".format(pgrep_output, stderr)
# In our test environment, this should only match one pid
assert(pgrep_output.count("\n") == 1)
namenode_pid = pgrep_output.strip()