21
21
import re
22
22
import uuid
23
23
24
+ from codeflare_sdk .cluster import cluster
25
+
24
26
parent = Path (__file__ ).resolve ().parents [1 ]
25
27
sys .path .append (str (parent ) + "/src" )
26
28
@@ -250,6 +252,7 @@ def test_config_creation():
250
252
assert config .dispatch_priority == None
251
253
assert config .mcad == True
252
254
assert config .local_interactive == False
255
+
253
256
254
257
255
258
def test_cluster_creation (mocker ):
@@ -259,8 +262,7 @@ def test_cluster_creation(mocker):
259
262
assert filecmp .cmp (
260
263
"unit-test-cluster.yaml" , f"{ parent } /tests/test-case.yaml" , shallow = True
261
264
)
262
-
263
-
265
+
264
266
def test_cluster_creation_no_mcad (mocker ):
265
267
mocker .patch (
266
268
"kubernetes.client.CustomObjectsApi.get_cluster_custom_object" ,
@@ -311,6 +313,7 @@ def test_default_cluster_creation(mocker):
311
313
)
312
314
default_config = ClusterConfiguration (
313
315
name = "unit-test-default-cluster" ,
316
+ image = "quay.io/project-codeflare/ray:latest-py39-cu118" ,
314
317
)
315
318
cluster = Cluster (default_config )
316
319
@@ -614,6 +617,7 @@ def ingress_retrieval(port, annotations=None):
614
617
615
618
def test_ray_job_wrapping (mocker ):
616
619
cluster = cluster = createClusterWithConfig (mocker )
620
+ cluster .config .image = "quay.io/project-codeflare/ray:latest-py39-cu118"
617
621
mocker .patch (
618
622
"ray.job_submission.JobSubmissionClient._check_connection_and_version_with_url" ,
619
623
return_value = "None" ,
@@ -732,7 +736,7 @@ def test_ray_details(mocker, capsys):
732
736
"codeflare_sdk.cluster.cluster.Cluster.cluster_dashboard_uri" ,
733
737
return_value = "" ,
734
738
)
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" ))
736
740
captured = capsys .readouterr ()
737
741
ray2 = _copy_to_ray (cf )
738
742
details = cf .details ()
@@ -1898,7 +1902,7 @@ def test_cluster_status(mocker):
1898
1902
head_mem = 8 ,
1899
1903
head_gpu = 0 ,
1900
1904
)
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" ))
1902
1906
mocker .patch ("codeflare_sdk.cluster.cluster._app_wrapper_status" , return_value = None )
1903
1907
mocker .patch ("codeflare_sdk.cluster.cluster._ray_cluster_status" , return_value = None )
1904
1908
status , ready = cf .status ()
@@ -1988,7 +1992,7 @@ def test_wait_ready(mocker, capsys):
1988
1992
mock_response = mocker .Mock ()
1989
1993
mock_response .status_code = 200
1990
1994
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" ))
1992
1996
try :
1993
1997
cf .wait_ready (timeout = 5 )
1994
1998
assert 1 == 0
@@ -2653,7 +2657,7 @@ def test_gen_app_wrapper_with_oauth(mocker: MockerFixture):
2653
2657
mocker .patch (
2654
2658
"codeflare_sdk.utils.generate_yaml.write_user_appwrapper" , write_user_appwrapper
2655
2659
)
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" ))
2657
2661
user_yaml = write_user_appwrapper .call_args .args [0 ]
2658
2662
assert any (
2659
2663
container ["name" ] == "oauth-proxy"
0 commit comments