World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#3765] improvement(client-python): Fixed missing-timeout Pylint rule for client-python (#5531)
Chun-Hao Liuc3087cda4681
diff --git a/clients/client-python/pylintrc b/clients/client-python/pylintrcindex c78053b71f..21bfe53e53 100644--- a/clients/client-python/pylintrc+++ b/clients/client-python/pylintrc@@ -37,7 +37,6 @@ disable=missing-class-docstring,no-member,fixme,unnecessary-pass,- missing-timeout, #TODO-fixduplicate-code, #TODO-fixtoo-many-arguments, #TODO-fixdiff --git a/clients/client-python/tests/integration/auth/test_oauth2_client.py b/clients/client-python/tests/integration/auth/test_oauth2_client.pyindex ee221a21e5..0f4a1e4ca9 100644--- a/clients/client-python/tests/integration/auth/test_oauth2_client.py+++ b/clients/client-python/tests/integration/auth/test_oauth2_client.py@@ -34,6 +34,7 @@ from tests.integration.integration_test_env import (check_gravitino_server_status,)from tests.integration.containers.oauth2_container import OAuth2Container+from tests.integration.config import Configlogger = logging.getLogger(__name__)@@ -93,7 +94,7 @@ class TestOAuth2(IntegrationTestEnv, TestCommonAuth):jwk_uri = f"{cls.oauth2_server_uri}/oauth2/jwks"# Get JWK from OAuth2 Server- res = requests.get(jwk_uri).json()+ res = requests.get(jwk_uri, timeout=Config.REQUEST["TIMEOUT"]).json()key = res["keys"][0]# Convert JWK to PEMdiff --git a/clients/client-python/tests/integration/config.py b/clients/client-python/tests/integration/config.pynew file mode 100644index 0000000000..45bf357fb4--- /dev/null+++ b/clients/client-python/tests/integration/config.py@@ -0,0 +1,20 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.+++class Config:+ REQUEST = {"TIMEOUT": 30}diff --git a/clients/client-python/tests/integration/integration_test_env.py b/clients/client-python/tests/integration/integration_test_env.pyindex d0d39a06da..9344ff93a2 100644--- a/clients/client-python/tests/integration/integration_test_env.py+++ b/clients/client-python/tests/integration/integration_test_env.py@@ -26,13 +26,18 @@ import shutilimport requestsfrom gravitino.exceptions.base import GravitinoRuntimeException+from tests.integration.config import Configlogger = logging.getLogger(__name__)def get_gravitino_server_version(**kwargs):try:- response = requests.get("http://localhost:8090/api/version", **kwargs)+ response = requests.get(+ "http://localhost:8090/api/version",+ timeout=Config.REQUEST["TIMEOUT"],+ **kwargs,+ )response.raise_for_status() # raise an exception for bad status codesresponse.close()return True