Skip to content

Commit e5bdb8a

Browse files
committed
update unit tests
1 parent c58a35e commit e5bdb8a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: src/codeflare_sdk/utils/generate_yaml.py

+2
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ def get_default_kueue_name(namespace: str):
309309

310310

311311
def local_queue_exists(namespace, local_queue_name: str):
312+
# get all local queues in the namespace
312313
try:
313314
config_check()
314315
api_instance = client.CustomObjectsApi(api_config_handler())
@@ -320,6 +321,7 @@ def local_queue_exists(namespace, local_queue_name: str):
320321
)
321322
except Exception as e: # pragma: no cover
322323
return _kube_api_error_handling(e)
324+
# check if local queue with the name provided in cluster config exists
323325
for lq in local_queues["items"]:
324326
if lq["metadata"]["name"] == local_queue_name:
325327
return True

Diff for: tests/unit_test.py

+8
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ def test_cluster_creation_no_mcad_local_queue(mocker):
344344
"kubernetes.client.CustomObjectsApi.get_cluster_custom_object",
345345
return_value={"spec": {"domain": "apps.cluster.awsroute.org"}},
346346
)
347+
mocker.patch(
348+
"kubernetes.client.CustomObjectsApi.list_namespaced_custom_object",
349+
return_value=get_local_queue("kueue.x-k8s.io", "v1beta1", "ns", "localqueues"),
350+
)
347351
config = createClusterConfig()
348352
config.name = "unit-test-cluster-ray"
349353
config.mcad = False
@@ -3015,6 +3019,10 @@ def test_cluster_throw_for_no_raycluster(mocker: MockerFixture):
30153019
"codeflare_sdk.utils.generate_yaml.get_default_kueue_name",
30163020
return_value="default",
30173021
)
3022+
mocker.patch(
3023+
"codeflare_sdk.utils.generate_yaml.local_queue_exists",
3024+
return_value="true",
3025+
)
30183026

30193027
def throw_if_getting_raycluster(group, version, namespace, plural):
30203028
if plural == "rayclusters":

0 commit comments

Comments
 (0)