Skip to content

Commit 9c1e65d

Browse files
Ygnasopenshift-merge-bot[bot]
authored andcommitted
Unit test to validate Cluster configuration parameters
1 parent 4dca262 commit 9c1e65d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Diff for: tests/unit_test.py

+6
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
@@ -268,6 +269,11 @@ def test_config_creation():
268269
assert config.appwrapper == True
269270

270271

272+
def test_config_creation_wrong_type():
273+
with pytest.raises(TypeError):
274+
config = createClusterWrongType()
275+
276+
271277
def test_cluster_creation(mocker):
272278
# Create AppWrapper containing a Ray Cluster with no local queue specified
273279
mocker.patch("kubernetes.client.ApisApi.get_api_versions")

Diff for: tests/unit_test_support.py

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

0 commit comments

Comments
 (0)