2121import re
2222import uuid
2323
24+ from codeflare_sdk .cluster import cluster
25+
2426parent = Path (__file__ ).resolve ().parents [1 ]
2527sys .path .append (str (parent ) + "/src" )
2628
@@ -250,6 +252,7 @@ def test_config_creation():
250252 assert config .dispatch_priority == None
251253 assert config .mcad == True
252254 assert config .local_interactive == False
255+
253256
254257
255258def test_cluster_creation (mocker ):
@@ -259,8 +262,7 @@ def test_cluster_creation(mocker):
259262 assert filecmp .cmp (
260263 "unit-test-cluster.yaml" , f"{ parent } /tests/test-case.yaml" , shallow = True
261264 )
262-
263-
265+
264266def test_cluster_creation_no_mcad (mocker ):
265267 mocker .patch (
266268 "kubernetes.client.CustomObjectsApi.get_cluster_custom_object" ,
@@ -311,6 +313,7 @@ def test_default_cluster_creation(mocker):
311313 )
312314 default_config = ClusterConfiguration (
313315 name = "unit-test-default-cluster" ,
316+ image = "quay.io/project-codeflare/ray:latest-py39-cu118" ,
314317 )
315318 cluster = Cluster (default_config )
316319
@@ -614,6 +617,7 @@ def ingress_retrieval(port, annotations=None):
614617
615618def test_ray_job_wrapping (mocker ):
616619 cluster = cluster = createClusterWithConfig (mocker )
620+ cluster .config .image = "quay.io/project-codeflare/ray:latest-py39-cu118"
617621 mocker .patch (
618622 "ray.job_submission.JobSubmissionClient._check_connection_and_version_with_url" ,
619623 return_value = "None" ,
@@ -732,7 +736,7 @@ def test_ray_details(mocker, capsys):
732736 "codeflare_sdk.cluster.cluster.Cluster.cluster_dashboard_uri" ,
733737 return_value = "" ,
734738 )
735- cf = Cluster (ClusterConfiguration (name = "raytest2" , namespace = "ns" ))
739+ cf = Cluster (ClusterConfiguration (name = "raytest2" , namespace = "ns" , image = "quay.io/project-codeflare/ray:latest-py39-cu118" ))
736740 captured = capsys .readouterr ()
737741 ray2 = _copy_to_ray (cf )
738742 details = cf .details ()
@@ -1898,7 +1902,7 @@ def test_cluster_status(mocker):
18981902 head_mem = 8 ,
18991903 head_gpu = 0 ,
19001904 )
1901- cf = Cluster (ClusterConfiguration (name = "test" , namespace = "ns" ))
1905+ cf = Cluster (ClusterConfiguration (name = "test" , namespace = "ns" , image = "quay.io/project-codeflare/ray:latest-py39-cu118" ))
19021906 mocker .patch ("codeflare_sdk.cluster.cluster._app_wrapper_status" , return_value = None )
19031907 mocker .patch ("codeflare_sdk.cluster.cluster._ray_cluster_status" , return_value = None )
19041908 status , ready = cf .status ()
@@ -1988,7 +1992,7 @@ def test_wait_ready(mocker, capsys):
19881992 mock_response = mocker .Mock ()
19891993 mock_response .status_code = 200
19901994 mocker .patch ("requests.get" , return_value = mock_response )
1991- cf = Cluster (ClusterConfiguration (name = "test" , namespace = "ns" ))
1995+ cf = Cluster (ClusterConfiguration (name = "test" , namespace = "ns" , image = "quay.io/project-codeflare/ray:latest-py39-cu118" ))
19921996 try :
19931997 cf .wait_ready (timeout = 5 )
19941998 assert 1 == 0
@@ -2653,7 +2657,7 @@ def test_gen_app_wrapper_with_oauth(mocker: MockerFixture):
26532657 mocker .patch (
26542658 "codeflare_sdk.utils.generate_yaml.write_user_appwrapper" , write_user_appwrapper
26552659 )
2656- Cluster (ClusterConfiguration ("test_cluster" , openshift_oauth = True ))
2660+ Cluster (ClusterConfiguration ("test_cluster" , openshift_oauth = True , image = "quay.io/project-codeflare/ray:latest-py39-cu118" ))
26572661 user_yaml = write_user_appwrapper .call_args .args [0 ]
26582662 assert any (
26592663 container ["name" ] == "oauth-proxy"
0 commit comments