mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-7385: Fix test-with-docker errors having to do with time zones.
ExprTest.TimestampFunctions, query_test.test_scanners.TestOrc.test_type_conversions, and query_test.test_queries.TestHdfsQueries.test_hdfs_scan_node were all failing when using test-with-docker with mismatched dates. As it turns out, there is code that calls readlink(/etc/localtime) and parses the output to identify the current timezone name. This is described in localtime(5) on Ubuntu16: It should be an absolute or relative symbolic link pointing to /usr/share/zoneinfo/, followed by a timezone identifier such as "Europe/Berlin" or "Etc/UTC". ... Because the timezone identifier is extracted from the symlink target name of /etc/localtime, this file may not be a normal file or hardlink." To honor this requirement, and to make the tests pass, I re-jiggered how I pass the time zone information from the host into the container. The previously failing tests now pass. Change-Id: Ia9facfd9741806e7dbb868d8d06d9296bf86e52f Reviewed-on: http://gerrit.cloudera.org:8080/11106 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
e6bf4dc2a1
commit
cf5de09761
@@ -499,6 +499,12 @@ class TestWithDocker(object):
|
||||
if self.test_mode:
|
||||
extras = ["-e", "TEST_TEST_WITH_DOCKER=true"] + extras
|
||||
|
||||
# According to localtime(5), /etc/localtime is supposed
|
||||
# to be a symlink to somewhere inside /usr/share/zoneinfo
|
||||
assert os.path.islink("/etc/localtime")
|
||||
localtime_link_target = os.path.realpath("/etc/localtime")
|
||||
assert localtime_link_target.startswith("/usr/share/zoneinfo")
|
||||
|
||||
container_id = _check_output([
|
||||
"docker", "create",
|
||||
# Required for some of the ntp handling in bootstrap and Kudu;
|
||||
@@ -526,9 +532,9 @@ class TestWithDocker(object):
|
||||
"-v", self.git_root + ":/repo:ro",
|
||||
"-v", self.git_common_dir + ":/git_common_dir:ro",
|
||||
"-e", "GIT_HEAD_REV=" + self.git_head_rev,
|
||||
"-v", self.ccache_dir + ":/ccache",
|
||||
# Share timezone between host and container
|
||||
"-v", "/etc/localtime:/mnt/localtime",
|
||||
"-e", "LOCALTIME_LINK_TARGET=" + localtime_link_target,
|
||||
"-v", self.ccache_dir + ":/ccache",
|
||||
"-v", _make_dir_if_not_exist(self.log_dir,
|
||||
logdir) + ":/logs",
|
||||
"-v", base + ":/mnt/base:ro"]
|
||||
|
||||
Reference in New Issue
Block a user