Skip to content

Commit 60a57c9

Browse files
Danelegendclaude
andcommitted
test(health): assert SERVICE_VERSION matches the Helm chart version
Catches drift between the Python package version (what /health reports to clients) and the chart version (what's actually deployed). If they get out of sync, a client gating on /health's version may try to use features that aren't actually shipped. Reads kubernetes/code-interpreter/Chart.yaml directly via a small regex so the test has no extra dependencies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 44bbde4 commit 60a57c9

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

code-interpreter/tests/integration_tests/test_health.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from __future__ import annotations
22

3+
import re
34
import subprocess
45
from collections.abc import Generator
6+
from pathlib import Path
57
from unittest.mock import patch
68

79
import pytest
@@ -12,6 +14,8 @@
1214
from app.services.executor_docker import DockerExecutor
1315
from app.services.executor_factory import get_executor
1416

17+
CHART_YAML = Path(__file__).resolve().parents[3] / "kubernetes" / "code-interpreter" / "Chart.yaml"
18+
1519

1620
@pytest.fixture(autouse=True)
1721
def _clear_executor_cache() -> Generator[None, None, None]:
@@ -53,6 +57,24 @@ def test_health_version_matches_package_metadata() -> None:
5357
assert package_version("code-interpreter") == SERVICE_VERSION
5458

5559

60+
def test_service_version_matches_helm_chart_version() -> None:
61+
"""Guard against drift between the Python package and the Helm chart.
62+
63+
A version mismatch means clients calling /health to gate on capabilities
64+
would see one number while the deployment artifact reports another.
65+
"""
66+
assert CHART_YAML.is_file(), f"Chart.yaml not found at {CHART_YAML}"
67+
text = CHART_YAML.read_text(encoding="utf-8")
68+
match = re.search(r"^version:\s*(\S+)\s*$", text, re.MULTILINE)
69+
assert match is not None, f"could not find a top-level 'version:' line in {CHART_YAML}"
70+
chart_version = match.group(1).strip("\"'")
71+
assert chart_version == SERVICE_VERSION, (
72+
f"Helm chart version {chart_version!r} != Python package version "
73+
f"{SERVICE_VERSION!r}. Bump both together so /health and the deployed "
74+
"chart report the same number."
75+
)
76+
77+
5678
def _make_completed(returncode: int, stderr: bytes = b"") -> subprocess.CompletedProcess[bytes]:
5779
return subprocess.CompletedProcess(args=[], returncode=returncode, stdout=b"", stderr=stderr)
5880

0 commit comments

Comments
 (0)