You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:37:37 UTC
[GitHub] [airflow] potiuk commented on a diff in pull request #26848: Deprecate use of core kube_client in PodManager
potiuk commented on code in PR #26848:
URL: https://github.com/apache/airflow/pull/26848#discussion_r990948490
##########
tests/providers/cncf/kubernetes/utils/test_pod_manager.py:
##########
@@ -331,6 +332,23 @@ def test_fetch_container_running_follow(
assert ret.last_log_time == DateTime(2021, 1, 1, tzinfo=Timezone('UTC'))
assert ret.running is exp_running
+ def test_pod_manager_get_client_call_deprecation(self):
+ """Ensure that kube_client.get_kube_client is removed from pod manager in provider 6.0."""
+ try:
+ from airflow.providers.cncf.kubernetes.utils.pod_manager import get_kube_client # noqa
+ except ImportError:
+ raise Exception(
+ "You must remove this test. It only exists to remind us to remove `get_kube_client`."
+ )
+ from airflow.providers_manager import ProvidersManager
+
+ info = ProvidersManager().providers['apache-airflow-providers-cncf-kubernetes']
+ if semver.VersionInfo.parse(info.version) >= (6, 0):
Review Comment:
I was thinking about extracting the "from .. import" as lambda in the form of:
```
lambda: __import__('airflow.providers.cncf.kubernetes.utils.pod_manager.get_kube_client')
```
Passed by parameterized. Then there could be one test covering multiple similar cases rather than having to copy the try/except/raise provider in multiple tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org