Skip to content

Commit 0f90df6

Browse files
committed
Adding coverage for the case of an openshift cluster
1 parent c343953 commit 0f90df6

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

Diff for: .coveragerc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[run]
2+
omit =
3+
src/**/test_*.py,,src/codeflare_sdk/common/utils/unit_test_support.py
4+
5+
[report]
6+
exclude_lines =
7+
pragma: no cover
8+

Diff for: src/codeflare_sdk/ray/cluster/test_cluster.py

+32
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,38 @@ def test_cluster_uris(mocker):
224224
)
225225

226226

227+
def test_openshift_cluster_dashboard_uri(mocker):
228+
# Mocking necessary dependencies
229+
mocker.patch("kubernetes.config.load_kube_config", return_value="ignore")
230+
mocker.patch(
231+
"codeflare_sdk.ray.cluster.cluster._is_openshift_cluster", return_value=True
232+
)
233+
mocker.patch(
234+
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
235+
return_value={
236+
"items": [
237+
{
238+
"metadata": {
239+
"name": "ray-dashboard-unit-test-cluster",
240+
"annotations": {"route.openshift.io/termination": "tls"},
241+
},
242+
"spec": {
243+
"host": "ray-dashboard-unit-test-cluster-ns.apps.cluster.awsroute.org",
244+
"tls": {"termination": "passthrough"},
245+
},
246+
}
247+
]
248+
},
249+
)
250+
# Creating the cluster instance
251+
cluster = create_cluster(mocker)
252+
# Validating the output
253+
assert (
254+
cluster.cluster_dashboard_uri()
255+
== "https://ray-dashboard-unit-test-cluster-ns.apps.cluster.awsroute.org"
256+
)
257+
258+
227259
def test_ray_job_wrapping(mocker):
228260
import ray
229261

0 commit comments

Comments
 (0)