Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion scripts/update_openhands_charts/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_chart_update(make_temp_yaml_file, sample_openhands_chart_minimal):
OPENHANDS_CHART_VERSION = "0.1.0" # Chart version (semver)
OPENHANDS_CHART_APP_VERSION = "cloud-1.0.0" # OpenHands uses cloud-X.Y.Z tags
OPENHANDS_CHART_RUNTIME_API_VERSION = "0.1.10" # runtime-api dependency version
OPENHANDS_CHART_AUTOMATION_VERSION = "0.1.1" # automation dependency version

# Variant-specific openhands chart values (only in with_deps variant)
OPENHANDS_CHART_WITH_DEPS_OTHER_DEP_VERSION = "1.0.0"
Expand All @@ -64,6 +65,10 @@ def test_chart_update(make_temp_yaml_file, sample_openhands_chart_minimal):
RUNTIME_API_CHART_MINIMAL_VERSION = "0.2.6"
RUNTIME_API_CHART_MINIMAL_APP_VERSION = "0.1.0"

# sample_automation_chart fixture values
AUTOMATION_CHART_VERSION = "0.1.1"
AUTOMATION_CHART_APP_VERSION = "0.1.0"

# =============================================================================
# Test input constants
# These values are used as inputs when testing update operations.
Expand All @@ -73,6 +78,7 @@ def test_chart_update(make_temp_yaml_file, sample_openhands_chart_minimal):
# New versions used when testing chart updates
NEW_APP_VERSION = "cloud-2.0.0" # OpenHands appVersion uses cloud-X.Y.Z tags
NEW_RUNTIME_API_VERSION = "0.2.0"
NEW_AUTOMATION_VERSION = "0.1.2"


def get_dependency_version(file_path: Path, dep_name: str) -> str | None:
Expand Down Expand Up @@ -251,7 +257,7 @@ def _make_temp_file(content: str) -> Path:

@pytest.fixture
def sample_openhands_chart_with_deps():
"""Sample openhands Chart.yaml with runtime-api dependency."""
"""Sample openhands Chart.yaml with runtime-api and automation dependencies."""
return """\
apiVersion: v2
description: Test chart
Expand All @@ -265,6 +271,10 @@ def sample_openhands_chart_with_deps():
repository: oci://ghcr.io/all-hands-ai/helm-charts
version: 0.1.10
condition: runtime-api.enabled
- name: automation
repository: oci://ghcr.io/all-hands-ai/helm-charts
version: 0.1.1
condition: automation.enabled
- name: other-dep
version: 1.0.0
"""
Expand All @@ -281,6 +291,8 @@ def sample_openhands_chart_minimal():
dependencies:
- name: runtime-api
version: 0.1.10
- name: automation
version: 0.1.1
"""


Expand Down Expand Up @@ -334,6 +346,28 @@ def sample_runtime_api_chart_minimal():
"""


@pytest.fixture
def sample_automation_chart():
"""Sample automation Chart.yaml with dependencies."""
return """\
apiVersion: v2
name: automation
description: OpenHands Automations Service
type: application
version: 0.1.1
appVersion: "0.1.0"
dependencies:
- name: postgresql
version: 15.x.x
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: minio
version: 5.0.10
repository: https://charts.min.io/
condition: minio.enabled
"""


# =============================================================================
# Common values.yaml fixtures
# =============================================================================
Expand Down Expand Up @@ -415,6 +449,28 @@ def sample_runtime_api_values():
"""


@pytest.fixture
def sample_automation_values():
"""Sample automation values.yaml."""
return """\
image:
repository: ghcr.io/openhands/automation
tag: 1.20.0

imagePullSecrets: []

deployment:
replicas: 1
resources:
requests:
memory: 256Mi
cpu: 100m
limits:
memory: 512Mi
cpu: 500m
"""


# =============================================================================
# GitHub API mock fixtures
# =============================================================================
Expand Down
Loading