@@ -481,6 +481,7 @@ def arg_check_del_effect(group, version, namespace, plural, name, *args):
481
481
def test_cluster_up_down (mocker ):
482
482
mocker .patch ("kubernetes.client.ApisApi.get_api_versions" )
483
483
mocker .patch ("kubernetes.config.load_kube_config" , return_value = "ignore" )
484
+ mocker .patch ("codeflare_sdk.cluster.cluster.Cluster._throw_for_no_raycluster" )
484
485
mocker .patch (
485
486
"kubernetes.client.CustomObjectsApi.get_cluster_custom_object" ,
486
487
return_value = {"spec" : {"domain" : "" }},
@@ -503,6 +504,7 @@ def test_cluster_up_down(mocker):
503
504
504
505
505
506
def test_cluster_up_down_no_mcad (mocker ):
507
+ mocker .patch ("codeflare_sdk.cluster.cluster.Cluster._throw_for_no_raycluster" )
506
508
mocker .patch ("kubernetes.client.ApisApi.get_api_versions" )
507
509
mocker .patch ("kubernetes.config.load_kube_config" , return_value = "ignore" )
508
510
mocker .patch (
@@ -3273,6 +3275,29 @@ def test_gen_app_wrapper_with_oauth(mocker: MockerFixture):
3273
3275
)
3274
3276
3275
3277
3278
+ def test_cluster_throw_for_no_raycluster (mocker : MockerFixture ):
3279
+ mocker .patch ("kubernetes.client.ApisApi.get_api_versions" )
3280
+ mocker .patch (
3281
+ "codeflare_sdk.cluster.cluster.get_current_namespace" ,
3282
+ return_value = "opendatahub" ,
3283
+ )
3284
+ mocker .patch (
3285
+ "kubernetes.client.CustomObjectsApi.list_namespaced_custom_object" ,
3286
+ side_effect = client .ApiException (status = 404 ),
3287
+ )
3288
+ cluster = Cluster (
3289
+ ClusterConfiguration (
3290
+ "test_cluster" ,
3291
+ openshift_oauth = True ,
3292
+ image = "quay.io/project-codeflare/ray:latest-py39-cu118" ,
3293
+ ingress_domain = "apps.cluster.awsroute.org" ,
3294
+ write_to_file = False ,
3295
+ )
3296
+ )
3297
+ with pytest .raises (RuntimeError ):
3298
+ cluster .up ()
3299
+
3300
+
3276
3301
"""
3277
3302
Ray Jobs tests
3278
3303
"""
0 commit comments