|
39 | 39 | get_cluster,
|
40 | 40 | _app_wrapper_status,
|
41 | 41 | _ray_cluster_status,
|
42 |
| - _get_ingress_domain, |
43 | 42 | get_ingress_domain_from_client,
|
44 | 43 | )
|
45 | 44 | from codeflare_sdk.cluster.auth import (
|
|
48 | 47 | KubeConfigFileAuthentication,
|
49 | 48 | config_check,
|
50 | 49 | )
|
51 |
| -from codeflare_sdk.utils.openshift_oauth import ( |
52 |
| - create_openshift_oauth_objects, |
53 |
| - delete_openshift_oauth_objects, |
54 |
| -) |
55 | 50 | from codeflare_sdk.utils.pretty_print import (
|
56 | 51 | print_no_resources_found,
|
57 | 52 | print_app_wrappers_status,
|
|
92 | 87 | read_template,
|
93 | 88 | enable_local_interactive,
|
94 | 89 | )
|
95 |
| -import codeflare_sdk.utils.openshift_oauth as sdk_oauth |
96 | 90 |
|
97 | 91 | import openshift
|
98 | 92 | from openshift.selector import Selector
|
|
114 | 108 |
|
115 | 109 | def mock_routes_api(mocker):
|
116 | 110 | mocker.patch.object(
|
117 |
| - sdk_oauth, |
118 | 111 | "_route_api_getter",
|
119 | 112 | return_value=MagicMock(
|
120 | 113 | resources=MagicMock(
|
@@ -589,24 +582,6 @@ def test_rc_status(mocker):
|
589 | 582 | assert rc == None
|
590 | 583 |
|
591 | 584 |
|
592 |
| -def test_delete_openshift_oauth_objects(mocker): |
593 |
| - mocker.patch.object(client.CoreV1Api, "delete_namespaced_service_account") |
594 |
| - mocker.patch.object(client.CoreV1Api, "delete_namespaced_service") |
595 |
| - mocker.patch.object(client.NetworkingV1Api, "delete_namespaced_ingress") |
596 |
| - mocker.patch.object(client.RbacAuthorizationV1Api, "delete_cluster_role_binding") |
597 |
| - mock_routes_api(mocker) |
598 |
| - delete_openshift_oauth_objects("test-cluster", "test-namespace") |
599 |
| - client.CoreV1Api.delete_namespaced_service_account.assert_called_with( |
600 |
| - name="test-cluster-oauth-proxy", namespace="test-namespace" |
601 |
| - ) |
602 |
| - client.CoreV1Api.delete_namespaced_service.assert_called_with( |
603 |
| - name="test-cluster-oauth", namespace="test-namespace" |
604 |
| - ) |
605 |
| - client.RbacAuthorizationV1Api.delete_cluster_role_binding.assert_called_with( |
606 |
| - name="test-cluster-rb" |
607 |
| - ) |
608 |
| - |
609 |
| - |
610 | 585 | def test_cluster_uris(mocker):
|
611 | 586 | mocker.patch("kubernetes.client.ApisApi.get_api_versions")
|
612 | 587 | mocker.patch("kubernetes.config.load_kube_config", return_value="ignore")
|
@@ -2874,84 +2849,6 @@ def test_enable_local_interactive(mocker):
|
2874 | 2849 | }
|
2875 | 2850 |
|
2876 | 2851 |
|
2877 |
| -def test_create_openshift_oauth(mocker: MockerFixture): |
2878 |
| - create_namespaced_service_account = MagicMock() |
2879 |
| - create_cluster_role_binding = MagicMock() |
2880 |
| - create_namespaced_service = MagicMock() |
2881 |
| - mocker.patch.object( |
2882 |
| - client.CoreV1Api, |
2883 |
| - "create_namespaced_service_account", |
2884 |
| - create_namespaced_service_account, |
2885 |
| - ) |
2886 |
| - mocker.patch.object( |
2887 |
| - client.RbacAuthorizationV1Api, |
2888 |
| - "create_cluster_role_binding", |
2889 |
| - create_cluster_role_binding, |
2890 |
| - ) |
2891 |
| - mocker.patch.object( |
2892 |
| - client.CoreV1Api, "create_namespaced_service", create_namespaced_service |
2893 |
| - ) |
2894 |
| - mock_routes_api(mocker) |
2895 |
| - create_openshift_oauth_objects("foo", "bar") |
2896 |
| - create_ns_sa_args = create_namespaced_service_account.call_args |
2897 |
| - create_crb_args = create_cluster_role_binding.call_args |
2898 |
| - create_ns_serv_args = create_namespaced_service.call_args |
2899 |
| - assert ( |
2900 |
| - create_ns_sa_args.kwargs["namespace"] == create_ns_serv_args.kwargs["namespace"] |
2901 |
| - ) |
2902 |
| - assert isinstance(create_ns_sa_args.kwargs["body"], client.V1ServiceAccount) |
2903 |
| - assert isinstance(create_crb_args.kwargs["body"], client.V1ClusterRoleBinding) |
2904 |
| - assert isinstance(create_ns_serv_args.kwargs["body"], client.V1Service) |
2905 |
| - |
2906 |
| - |
2907 |
| -def test_replace_openshift_oauth(mocker: MockerFixture): |
2908 |
| - # not_found_exception = client.ApiException(reason="Conflict") |
2909 |
| - create_namespaced_service_account = MagicMock( |
2910 |
| - side_effect=client.ApiException(reason="Conflict") |
2911 |
| - ) |
2912 |
| - create_cluster_role_binding = MagicMock( |
2913 |
| - side_effect=client.ApiException(reason="Conflict") |
2914 |
| - ) |
2915 |
| - create_namespaced_service = MagicMock( |
2916 |
| - side_effect=client.ApiException(reason="Conflict") |
2917 |
| - ) |
2918 |
| - mocker.patch.object( |
2919 |
| - client.CoreV1Api, |
2920 |
| - "create_namespaced_service_account", |
2921 |
| - create_namespaced_service_account, |
2922 |
| - ) |
2923 |
| - mocker.patch.object( |
2924 |
| - client.RbacAuthorizationV1Api, |
2925 |
| - "create_cluster_role_binding", |
2926 |
| - create_cluster_role_binding, |
2927 |
| - ) |
2928 |
| - mocker.patch.object( |
2929 |
| - client.CoreV1Api, "create_namespaced_service", create_namespaced_service |
2930 |
| - ) |
2931 |
| - mocker.patch.object(dynamic.ResourceList, "get", return_value=True) |
2932 |
| - replace_namespaced_service_account = MagicMock() |
2933 |
| - replace_cluster_role_binding = MagicMock() |
2934 |
| - replace_namespaced_service = MagicMock() |
2935 |
| - mocker.patch.object( |
2936 |
| - client.CoreV1Api, |
2937 |
| - "replace_namespaced_service_account", |
2938 |
| - replace_namespaced_service_account, |
2939 |
| - ) |
2940 |
| - mocker.patch.object( |
2941 |
| - client.RbacAuthorizationV1Api, |
2942 |
| - "replace_cluster_role_binding", |
2943 |
| - replace_cluster_role_binding, |
2944 |
| - ) |
2945 |
| - mocker.patch.object( |
2946 |
| - client.CoreV1Api, "replace_namespaced_service", replace_namespaced_service |
2947 |
| - ) |
2948 |
| - mock_routes_api(mocker) |
2949 |
| - create_openshift_oauth_objects("foo", "bar") |
2950 |
| - replace_namespaced_service_account.assert_called_once() |
2951 |
| - replace_cluster_role_binding.assert_called_once() |
2952 |
| - replace_namespaced_service.assert_called_once() |
2953 |
| - |
2954 |
| - |
2955 | 2852 | def test_gen_app_wrapper_with_oauth(mocker: MockerFixture):
|
2956 | 2853 | mocker.patch("kubernetes.client.ApisApi.get_api_versions")
|
2957 | 2854 | mocker.patch(
|
|
0 commit comments