Skip to content

Commit 6587c73

Browse files
committed
Unit test to validate Cluster configuration parameters
1 parent 255f946 commit 6587c73

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/unit_test.py

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
from tests.unit_test_support import (
6868
createClusterWithConfig,
6969
createClusterConfig,
70+
createClusterWrongType,
7071
)
7172

7273
import codeflare_sdk.utils.kube_api_helpers
@@ -267,6 +268,10 @@ def test_config_creation():
267268
assert config.image_pull_secrets == ["unit-test-pull-secret"]
268269
assert config.appwrapper == True
269270

271+
def test_config_creation_wrong_type():
272+
with pytest.raises(TypeError):
273+
config = createClusterWrongType()
274+
270275

271276
def test_cluster_creation(mocker):
272277
# Create AppWrapper containing a Ray Cluster with no local queue specified

tests/unit_test_support.py

+18
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,21 @@ def createClusterWithConfig(mocker):
3131
)
3232
cluster = Cluster(createClusterConfig())
3333
return cluster
34+
35+
def createClusterWrongType():
36+
config = ClusterConfiguration(
37+
name="unit-test-cluster",
38+
namespace="ns",
39+
num_workers=2,
40+
worker_cpu_requests=[],
41+
worker_cpu_limits=4,
42+
worker_memory_requests=5,
43+
worker_memory_limits=6,
44+
worker_extended_resource_requests={"nvidia.com/gpu": 7},
45+
appwrapper=True,
46+
machine_types=["cpu.small", "gpu.large"],
47+
image_pull_secrets=["unit-test-pull-secret"],
48+
image="quay.io/rhoai/ray:2.23.0-py39-cu121",
49+
write_to_file=True,
50+
)
51+
return config

0 commit comments

Comments
 (0)