diff --git a/tests/unit_test.py b/tests/unit_test.py index 2decade20..bb14d2b20 100644 --- a/tests/unit_test.py +++ b/tests/unit_test.py @@ -67,6 +67,7 @@ from tests.unit_test_support import ( createClusterWithConfig, createClusterConfig, + createClusterWrongType, ) import codeflare_sdk.utils.kube_api_helpers @@ -268,6 +269,11 @@ def test_config_creation(): assert config.appwrapper == True +def test_config_creation_wrong_type(): + with pytest.raises(TypeError): + config = createClusterWrongType() + + def test_cluster_creation(mocker): # Create AppWrapper containing a Ray Cluster with no local queue specified mocker.patch("kubernetes.client.ApisApi.get_api_versions") diff --git a/tests/unit_test_support.py b/tests/unit_test_support.py index 36c7d8710..25e206c52 100644 --- a/tests/unit_test_support.py +++ b/tests/unit_test_support.py @@ -31,3 +31,23 @@ def createClusterWithConfig(mocker): ) cluster = Cluster(createClusterConfig()) return cluster + + +def createClusterWrongType(): + config = ClusterConfiguration( + name="unit-test-cluster", + namespace="ns", + num_workers=2, + worker_cpu_requests=[], + worker_cpu_limits=4, + worker_memory_requests=5, + worker_memory_limits=6, + worker_extended_resource_requests={"nvidia.com/gpu": 7}, + appwrapper=True, + machine_types=[True, False], + image_pull_secrets=["unit-test-pull-secret"], + image="quay.io/rhoai/ray:2.23.0-py39-cu121", + write_to_file=True, + labels={1: 1}, + ) + return config