GKE code executor unit tests fail with kubernetes 37.0.0, turning main CI red
維護者通常 5 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 76/100
研究方向
從 tests/unittests/code_executors/test_gke_code_executor.py 開始,檢查五個失敗測試中如何模擬 create_namespaced_job。使用 kubernetes 37.0.0 執行指定的 pytest 命令,接著將 mock 的回傳值與 _add_owner_reference 使用的實際 V1Job 欄位進行比較。在 kubernetes 36.0.3 和 37.0.0 上的全部 18 個測試都通過,即表示完成。
由索引模型根據 Issue 內容生成。
描述
🔴 Required Information
Describe the Bug:
Since kubernetes 37.0.0 was published to PyPI (2026-10-07, 00:51 UTC), five tests in tests/unittests/code_executors/test_gke_code_executor.py fail. The Unit Tests jobs of the Continuous Integration workflow have failed on main for Python 3.11–3.14 on every push since 51a20e24, because CI installs the newest version kubernetes>=29 allows.
kubernetes 37 validates model fields with pydantic. In these tests create_namespaced_job returns the default MagicMock, and GkeCodeExecutor._add_owner_reference copies that Job's api_version, kind, metadata.name and metadata.uid into a V1OwnerReference, which now raises a ValidationError. execute_code catches it and returns "An unexpected executor error occurred", so the assertions fail.
Only the tests are affected. Against a real cluster, create_namespaced_job returns a V1Job with string fields. The other 13 tests in the file pass on 37.0.0, including the one that builds a real Job manifest.
Steps to Reproduce:
pip install -e . pytest pytest-asyncio pytest-mock "kubernetes==37.0.0"pytest tests/unittests/code_executors/test_gke_code_executor.py
Expected Behavior:
All 18 tests pass, as they do with kubernetes 36.0.3 (the version pinned in constraints-3.*.txt).
Observed Behavior:
FAILED ...::test_execute_code_success - AssertionError: assert '' == 'hello world'
FAILED ...::test_execute_code_job_failed - assert 'Job failed. Logs:' in "An unexpected executor error occurred: 4 validation errors for V1OwnerReference ..."
FAILED ...::test_execute_code_job_failed_without_terminated_container - assert None == 1
FAILED ...::test_execute_code_timeout - assert 'Executor timed out' in "An unexpected executor error occurred: 4 validation errors for V1OwnerReference ..."
FAILED ...::test_execute_code_forks_to_job - AssertionError: assert '' == 'job stdout'
5 failed, 13 passed
The underlying error:
4 validation errors for V1OwnerReference
api_version
Input should be a valid string [type=string_type, input_value=<MagicMock name='mock.api...ersion' id='...'>, input_type=MagicMock]
kind
Input should be a valid string [type=string_type, input_value=<MagicMock name='mock.kind' id='...'>, input_type=MagicMock]
name
Input should be a valid string [type=string_type, input_value=<MagicMock name='mock.met...a.name' id='...'>, input_type=MagicMock]
uid
Input should be a valid string [type=string_type, input_value=<MagicMock name='mock.met...ta.uid' id='...'>, input_type=MagicMock]
Environment Details:
- ADK Library Version:
main(2.11.0), since 51a20e24 - Desktop OS: Linux (GitHub Actions) and macOS
- Python Version: 3.11, 3.12, 3.13 and 3.14
Model Information:
- Are you using LiteLLM: N/A
- Which model is being used: N/A, no model is involved
🟡 Optional Information
Regression:
Yes, but the regression comes from the dependency release, not from an ADK commit. The same tests pass with kubernetes 36.0.3.
Logs:
CI run on main: https://github.com/google/adk-python/actions/runs/37674194847
Additional Context:
constraints-3.*.txt already pin kubernetes==36.0.3, but the unit test job installs without them. A fix that keeps the tests passing on both versions is to have the mocked create_namespaced_job return a real client.V1Job with string fields. I'll open a PR.
How often has this issue occurred?:
- Always (100%)
- 主要語言
- Python
- 星號
- 21.9k
- 分支
- 4.2k
- 平均合併
- 3 天 4 小時
- 30 天內合併 PR
- 7
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
google/adk-python 的其他 Issue
-
Update opentelemetry-api and opentelemetry-sdk to 1.44.0可能已有人在做 @llalitkumarrr 於 11 天前認領。 未關閉request clarification tracing
難度 2/5 1-3 小時 新手友好度 70/100
google/adk-python#7433 · 5 則留言 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
CI Mypy Check flags an existing streaming_utils.py error as new because the PR run reuses the baseline's mypy cache可能已有人在做 @DeanChensj 於 13 天前認領。 未關閉needs review
難度 2/5 1-3 小時 新手友好度 72/100
google/adk-python#7409 · 1 則留言 · 已指派 2 人 ·
維護者通常 5 天內回覆
-
A2aAgentExecutor sends the raw exception text to the A2A caller when the run fails可能已有人在做 @sanketpatil06 於 13 天前認領。 未關閉a2a request clarification
難度 2/5 1-3 小時 新手友好度 84/100
google/adk-python#7385 · 2 則留言 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
Please support mermaid 12 (inbuild elk) in `adk web`可能已有人在做 @sanketpatil06 於 14 天前認領。 未關閉needs review web
難度 2/5 1-3 小時 新手友好度 62/100
google/adk-python#7381 · 1 則留言 · 已指派 1 人 ·
維護者通常 5 天內回覆
-
[A2A] RemoteA2aAgent(use_legacy=False): extension header written to state['http_kwargs'], ignored by a2a-sdk 1.x transports可能已有人在做 @surajksharma07 於 20 天前認領。 未關閉a2a
難度 2/5 1-3 小時 新手友好度 84/100
google/adk-python#7334 · 2 則留言 · 已指派 1 人 ·
維護者通常 5 天內回覆
查看 google/adk-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 79/100
SACGF/variantgrid#2341 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆
-
comp/cli P3 type/security
難度 2/5 1-3 小時 新手友好度 68/100
NousResearch/hermes-agent#141420 · 1 則留言 ·
維護者通常 1 天內回覆
-
CKV_GCP_18 (GKEPublicControlPlane) passes when master_authorized_networks_config is absent, control plane is internet-reachable可能已有人在做 @Varshith-Kali 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
bridgecrewio/checkov#7753 ·
維護者通常 1 天內回覆