This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 5b4afb4f8f2c12aaff7454101be79acce87662b8
Author: Joe McDonnell <[email protected]>
AuthorDate: Tue Sep 10 12:29:06 2024 -0700

    IMPALA-13368: Fixup Redhat detection for Python >= 3.8
    
    Python 3.8 removed the platform.linux_distribution() function which is
    currently used to detect Redhat. This switches to using the 'distro'
    package, which implements the same functionality across different
    Python versions. Since Redhat 6 is no longer supported, this removes
    the detection of Redhat 6 and associated skip logic.
    
    Testing:
     - Ran a core job
    
    Change-Id: I0dfaf798c0239f6068f29adbd2eafafdbbfd66c3
    Reviewed-on: http://gerrit.cloudera.org:8080/22073
    Reviewed-by: Michael Smith <[email protected]>
    Reviewed-by: Riza Suminto <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 infra/python/deps/requirements.txt                |  1 +
 tests/common/environ.py                           | 13 ++++---------
 tests/common/skip.py                              |  6 +-----
 tests/custom_cluster/test_admission_controller.py |  6 +-----
 4 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/infra/python/deps/requirements.txt 
b/infra/python/deps/requirements.txt
index e70ef69e4..242d31467 100644
--- a/infra/python/deps/requirements.txt
+++ b/infra/python/deps/requirements.txt
@@ -61,6 +61,7 @@ texttable == 0.8.3
 virtualenv == 16.7.10
 avro==1.10.2
 thrift==0.16.0
+distro==1.6.0
 
 # Required for Kudu:
   Cython == 0.29.14
diff --git a/tests/common/environ.py b/tests/common/environ.py
index 165928157..38677634f 100644
--- a/tests/common/environ.py
+++ b/tests/common/environ.py
@@ -16,13 +16,13 @@
 # under the License.
 
 from __future__ import absolute_import, division, print_function
+import distro
 import json
 import logging
 import os
 import pytest
 import re
 import requests
-import platform
 
 LOG = logging.getLogger('tests.common.environ')
 test_start_cluster_args = os.environ.get("TEST_START_CLUSTER_ARGS", "")
@@ -48,16 +48,11 @@ if os.path.isfile(IMPALA_LOCAL_VERSION_INFO):
     raise Exception("Could not find VERSION in 
{0}".format(IMPALA_LOCAL_VERSION_INFO))
 
 # Check if it is Red Hat/CentOS/Rocky/AlmaLinux Linux
-distribution = platform.linux_distribution()
-distname = distribution[0].lower()
-version = distribution[1]
-IS_REDHAT_6_DERIVATIVE = False
 IS_REDHAT_DERIVATIVE = False
-if distname.find('centos') or distname.find('rocky') or \
-   distname.find('almalinux') or distname.find('red hat'):
+# Python >= 3.8 removed platform.linux_distribution(). This now uses the 
'distro'
+# package, which provides equivalent functionality across Python versions.
+if distro.id() in ['rhel', 'rocky', 'centos', 'almalinux']:
   IS_REDHAT_DERIVATIVE = True
-  if len(re.findall('^6\.*', version)) > 0:
-    IS_REDHAT_6_DERIVATIVE = True
 
 # Find the likely BuildType of the running Impala. Assume it's found through 
the path
 # $IMPALA_HOME/be/build/latest as a fallback.
diff --git a/tests/common/skip.py b/tests/common/skip.py
index bde2e3628..641da4169 100644
--- a/tests/common/skip.py
+++ b/tests/common/skip.py
@@ -26,7 +26,7 @@ from functools import partial
 
 from tests.common.environ import (ImpalaTestClusterProperties,
                                   IS_DOCKERIZED_TEST_CLUSTER, 
IS_BUGGY_EL6_KERNEL,
-                                  HIVE_MAJOR_VERSION, IS_REDHAT_6_DERIVATIVE,
+                                  HIVE_MAJOR_VERSION,
                                   IS_APACHE_HIVE, IS_TEST_JDK,
                                   IS_TUPLE_CACHE)
 from tests.common.kudu_test_suite import get_kudu_master_flag
@@ -265,10 +265,6 @@ class SkipIfCatalogV2:
       not IMPALA_TEST_CLUSTER_PROPERTIES.is_event_polling_enabled(),
       reason="Test expects event polling to be enabled.")
 
-class SkipIfOS:
-  redhat6 = pytest.mark.skipif(IS_REDHAT_6_DERIVATIVE,
-                               reason="Flaky on redhat or centos 6")
-
 
 class SkipIfApacheHive():
   feature_not_supported = pytest.mark.skipif(IS_APACHE_HIVE,
diff --git a/tests/custom_cluster/test_admission_controller.py 
b/tests/custom_cluster/test_admission_controller.py
index 1d03c23fd..c746cb221 100644
--- a/tests/custom_cluster/test_admission_controller.py
+++ b/tests/custom_cluster/test_admission_controller.py
@@ -41,7 +41,7 @@ from tests.common.custom_cluster_test_suite import (
 from tests.common.environ import build_flavor_timeout, 
ImpalaTestClusterProperties
 from tests.common.impala_test_suite import ImpalaTestSuite
 from tests.common.resource_pool_config import ResourcePoolConfig
-from tests.common.skip import SkipIfFS, SkipIfEC, SkipIfNotHdfsMinicluster, 
SkipIfOS
+from tests.common.skip import SkipIfFS, SkipIfEC, SkipIfNotHdfsMinicluster
 from tests.common.test_dimensions import (
     create_single_exec_option_dimension,
     create_uncompressed_text_dimension)
@@ -2500,7 +2500,6 @@ class 
TestAdmissionControllerStress(TestAdmissionControllerBase):
         raise thread.error
 
   @pytest.mark.execute_serially
-  @SkipIfOS.redhat6
   @CustomClusterTestSuite.with_args(
       
impalad_args=impalad_admission_ctrl_flags(max_requests=MAX_NUM_CONCURRENT_QUERIES,
         max_queued=MAX_NUM_QUEUED_QUERIES, pool_max_mem=-1, 
queue_wait_timeout_ms=600000),
@@ -2516,7 +2515,6 @@ class 
TestAdmissionControllerStress(TestAdmissionControllerBase):
       'mem_limit': sys.maxsize})
 
   @pytest.mark.execute_serially
-  @SkipIfOS.redhat6
   @CustomClusterTestSuite.with_args(
     impalad_args=impalad_admission_ctrl_config_args(
       fs_allocation_file="fair-scheduler-test2.xml",
@@ -2527,7 +2525,6 @@ class 
TestAdmissionControllerStress(TestAdmissionControllerBase):
     self.run_admission_test(vector, {'request_pool': self.pool_name})
 
   @pytest.mark.execute_serially
-  @SkipIfOS.redhat6
   @CustomClusterTestSuite.with_args(
     impalad_args=impalad_admission_ctrl_config_args(
       fs_allocation_file="fair-scheduler-test2.xml",
@@ -2553,7 +2550,6 @@ class 
TestAdmissionControllerStress(TestAdmissionControllerBase):
     return limit_metrics[0]
 
   @pytest.mark.execute_serially
-  @SkipIfOS.redhat6
   @CustomClusterTestSuite.with_args(
       impalad_args=impalad_admission_ctrl_flags(
         max_requests=MAX_NUM_CONCURRENT_QUERIES * 30, 
max_queued=MAX_NUM_QUEUED_QUERIES,

Reply via email to