@@ -397,7 +397,7 @@ def arg_check_apply_effect(group, version, namespace, plural, body, *args):
397397 with open (f"{ aw_dir } unit-test-cluster-ray.yaml" ) as f :
398398 yamls = yaml .load_all (f , Loader = yaml .FullLoader )
399399 for resource in yamls :
400- if resource ["kind" ] == "Route " :
400+ if resource ["kind" ] == "Ingress " :
401401 assert body == resource
402402 else :
403403 assert 1 == 0
@@ -414,8 +414,8 @@ def arg_check_del_effect(group, version, namespace, plural, name, *args):
414414 assert group == "ray.io"
415415 assert version == "v1alpha1"
416416 assert name == "unit-test-cluster-ray"
417- elif plural == "routes " :
418- assert group == "route.openshift .io"
417+ elif plural == "ingresses " :
418+ assert group == "networking.k8s .io"
419419 assert version == "v1"
420420 assert name == "ray-dashboard-unit-test-cluster-ray"
421421
@@ -623,7 +623,13 @@ def ingress_retrieval(port, annotations=None):
623623 serviceName = "dashboard"
624624 mock_ingress = client .V1Ingress (
625625 metadata = client .V1ObjectMeta (
626- name = f"ray-{ serviceName } -unit-test-cluster" , annotations = annotations
626+ name = f"ray-{ serviceName } -unit-test-cluster" ,
627+ annotations = annotations ,
628+ owner_references = [
629+ client .V1OwnerReference (
630+ api_version = "v1" , kind = "Ingress" , name = "quicktest" , uid = "unique-id"
631+ )
632+ ],
627633 ),
628634 spec = client .V1IngressSpec (
629635 rules = [
@@ -1148,6 +1154,11 @@ def get_ray_obj(group, version, namespace, plural, cls=None):
11481154 return api_obj
11491155
11501156
1157+ def get_named_aw (group , version , namespace , plural , name ):
1158+ aws = get_aw_obj ("workload.codeflare.dev" , "v1beta1" , "ns" , "appwrappers" )
1159+ return aws ["items" ][0 ]
1160+
1161+
11511162def get_aw_obj (group , version , namespace , plural ):
11521163 api_obj1 = {
11531164 "items" : [
@@ -1403,21 +1414,34 @@ def get_aw_obj(group, version, namespace, plural):
14031414 {
14041415 "allocated" : 0 ,
14051416 "generictemplate" : {
1406- "apiVersion" : "route.openshift .io/v1" ,
1407- "kind" : "Route " ,
1417+ "apiVersion" : "networking.k8s .io/v1" ,
1418+ "kind" : "Ingress " ,
14081419 "metadata" : {
1409- "labels" : {
1410- "odh-ray-cluster-service" : "quicktest-head-svc"
1411- },
1420+ "labels" : {"ingress-owner" : "appwrapper-name" },
14121421 "name" : "ray-dashboard-quicktest" ,
14131422 "namespace" : "default" ,
14141423 },
14151424 "spec" : {
1416- "port" : {"targetPort" : "dashboard" },
1417- "to" : {
1418- "kind" : "Service" ,
1419- "name" : "quicktest-head-svc" ,
1420- },
1425+ "ingressClassName" : "nginx" ,
1426+ "rules" : [
1427+ {
1428+ "http" : {
1429+ "paths" : {
1430+ "backend" : {
1431+ "service" : {
1432+ "name" : "quicktest-head-svc" ,
1433+ "port" : {
1434+ "number" : 8265
1435+ },
1436+ },
1437+ },
1438+ "pathType" : "Prefix" ,
1439+ "path" : "/" ,
1440+ },
1441+ },
1442+ "host" : "quicktest.awsroute.com" ,
1443+ }
1444+ ],
14211445 },
14221446 },
14231447 "metadata" : {},
@@ -1788,10 +1812,14 @@ def test_get_cluster(mocker):
17881812 side_effect = get_ray_obj ,
17891813 )
17901814 mocker .patch (
1791- "codeflare_sdk.utils.generate_yaml.is_openshift_cluster" ,
1792- return_value = True ,
1815+ "kubernetes.client.CustomObjectsApi.get_namespaced_custom_object" ,
1816+ side_effect = get_named_aw ,
1817+ )
1818+ mocker .patch (
1819+ "kubernetes.client.NetworkingV1Api.list_namespaced_ingress" ,
1820+ return_value = ingress_retrieval (port = 8265 ),
17931821 )
1794- cluster = get_cluster (cluster_name = "quicktest" )
1822+ cluster = get_cluster ("quicktest" )
17951823 cluster_config = cluster .config
17961824 assert cluster_config .name == "quicktest" and cluster_config .namespace == "ns"
17971825 assert (
0 commit comments