Skip to content

Commit b4c55e4

Browse files
Ygnasopenshift-merge-bot[bot]
authored andcommitted
Unit test for get_cluster with localqueue
1 parent c99424e commit b4c55e4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: tests/unit_test.py

+31
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,7 @@ def get_ray_obj(group, version, namespace, plural, cls=None):
10021002
"resourceName": "quicktest",
10031003
"workload.codeflare.dev/appwrapper": "quicktest",
10041004
"orderedinstance": "m4.xlarge_g4dn.xlarge",
1005+
"kueue.x-k8s.io/queue-name": "team-a-queue",
10051006
},
10061007
"managedFields": [
10071008
{
@@ -2483,6 +2484,36 @@ def test_get_cluster(mocker):
24832484
assert cluster_config.num_workers == 1
24842485

24852486

2487+
def test_get_cluster_no_mcad(mocker):
2488+
mocker.patch("kubernetes.client.ApisApi.get_api_versions")
2489+
mocker.patch("kubernetes.config.load_kube_config", return_value="ignore")
2490+
mocker.patch(
2491+
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
2492+
side_effect=get_ray_obj,
2493+
)
2494+
mocker.patch(
2495+
"kubernetes.client.NetworkingV1Api.list_namespaced_ingress",
2496+
return_value=ingress_retrieval(cluster_name="quicktest", client_ing=True),
2497+
)
2498+
cluster = get_cluster("quicktest")
2499+
cluster_config = cluster.config
2500+
assert cluster_config.name == "quicktest" and cluster_config.namespace == "ns"
2501+
assert (
2502+
"m4.xlarge" in cluster_config.machine_types
2503+
and "g4dn.xlarge" in cluster_config.machine_types
2504+
)
2505+
assert cluster_config.min_cpus == 1 and cluster_config.max_cpus == 1
2506+
assert cluster_config.min_memory == "2G" and cluster_config.max_memory == "2G"
2507+
assert cluster_config.num_gpus == 0
2508+
assert cluster_config.instascale
2509+
assert (
2510+
cluster_config.image
2511+
== "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"
2512+
)
2513+
assert cluster_config.num_workers == 1
2514+
assert cluster_config.local_queue == "team-a-queue"
2515+
2516+
24862517
def route_retrieval(group, version, namespace, plural, name):
24872518
assert group == "route.openshift.io"
24882519
assert version == "v1"

0 commit comments

Comments
 (0)