Skip to content

Commit dbcd1c7

Browse files
committed
Restructure tests to match providers/ layout, add parameterized platform fixture
Move test files from tests/cluster/platform/, tests/cluster/k8s/, and tests/kubernetes/ into tests/cluster/providers/{gcp,k8s}/ to mirror the source layout under src/iris/cluster/providers/. Add a shared conftest.py with parameterized gcp/coreweave platform fixtures. Update imports in test_autoscaler.py, test_snapshot_reconciliation.py, and test_vm_lifecycle.py to reference the new fakes module path.
1 parent 2e94564 commit dbcd1c7

21 files changed

Lines changed: 49 additions & 3 deletions

lib/iris/tests/cluster/controller/test_autoscaler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
from iris.cluster.types import WorkerStatus
4848
from iris.rpc import cluster_pb2, config_pb2, vm_pb2
4949
from iris.time_utils import Duration, Timestamp
50-
from tests.cluster.platform.fakes import FailureMode, FakePlatform, FakePlatformConfig
50+
from tests.cluster.providers.fakes import FailureMode, FakePlatform, FakePlatformConfig
5151

5252
# --- Test fixtures and helpers ---
5353

File renamed without changes.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright The Marin Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
"""Shared fixtures for provider tests.
5+
6+
Provides parameterized platform fixtures that allow protocol-level tests
7+
to run against both GCP (InMemoryGcpService DRY_RUN) and CoreWeave
8+
(InMemoryK8sService) backends.
9+
"""
10+
11+
from __future__ import annotations
12+
13+
import pytest
14+
15+
from iris.cluster.providers.gcp.fake_service import InMemoryGcpService
16+
from iris.cluster.providers.gcp.platform import GcpPlatform
17+
from iris.cluster.providers.k8s.fake_service import InMemoryK8sService
18+
from iris.cluster.providers.k8s.platform import CoreweavePlatform
19+
from iris.cluster.service_mode import ServiceMode
20+
from iris.rpc import config_pb2
21+
22+
23+
@pytest.fixture
24+
def gcp_platform():
25+
"""GcpPlatform backed by InMemoryGcpService for dry-run testing."""
26+
gcp_service = InMemoryGcpService(mode=ServiceMode.DRY_RUN, project_id="test-project")
27+
gcp_config = config_pb2.GcpPlatformConfig(project_id="test-project", zones=["us-central2-b"])
28+
return GcpPlatform(gcp_config, label_prefix="iris", gcp_service=gcp_service)
29+
30+
31+
@pytest.fixture
32+
def coreweave_platform():
33+
"""CoreweavePlatform backed by InMemoryK8sService."""
34+
k8s = InMemoryK8sService(namespace="iris")
35+
config = config_pb2.CoreweavePlatformConfig(region="LGA1", namespace="iris")
36+
platform = CoreweavePlatform(config=config, label_prefix="iris", poll_interval=0.05, kubectl=k8s)
37+
yield platform
38+
platform.shutdown()
39+
40+
41+
@pytest.fixture(params=["gcp", "coreweave"])
42+
def platform(request, gcp_platform, coreweave_platform):
43+
"""Parameterized fixture yielding each Platform implementation in turn."""
44+
if request.param == "gcp":
45+
return gcp_platform
46+
return coreweave_platform
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/iris/tests/cluster/platform/test_remote_exec.py renamed to lib/iris/tests/cluster/providers/gcp/test_remote_exec.py

File renamed without changes.

0 commit comments

Comments
 (0)