1515import pytest
1616import os
1717from unittest .mock import MagicMock , patch
18- from codeflare_sdk .common .utils .constants import CUDA_RUNTIME_IMAGE , RAY_VERSION
18+ from codeflare_sdk .common .utils .constants import MOUNT_PATH , RAY_VERSION
1919
2020from codeflare_sdk .ray .rayjobs .rayjob import RayJob
2121from codeflare_sdk .ray .cluster .config import ClusterConfiguration
@@ -1007,27 +1007,6 @@ def test_rayjob_user_override_shutdown_behavior(mocker):
10071007 assert rayjob_override_priority .shutdown_after_job_finishes is True
10081008
10091009
1010- def test_build_ray_cluster_spec_with_gcs_ft (mocker ):
1011- """Test build_ray_cluster_spec with GCS fault tolerance enabled."""
1012- from codeflare_sdk .ray .rayjobs .config import ManagedClusterConfig
1013-
1014- # Create a test cluster config with GCS FT enabled
1015- cluster_config = ManagedClusterConfig (
1016- enable_gcs_ft = True ,
1017- redis_address = "redis://redis-service:6379" ,
1018- external_storage_namespace = "storage-ns" ,
1019- )
1020-
1021- # Build the spec using the method on the cluster config
1022- spec = cluster_config .build_ray_cluster_spec ("test-cluster" )
1023-
1024- # Verify GCS fault tolerance options
1025- assert "gcsFaultToleranceOptions" in spec
1026- gcs_ft = spec ["gcsFaultToleranceOptions" ]
1027- assert gcs_ft ["redisAddress" ] == "redis://redis-service:6379"
1028- assert gcs_ft ["externalStorageNamespace" ] == "storage-ns"
1029-
1030-
10311010class TestRayVersionValidation :
10321011 """Test Ray version validation in RayJob."""
10331012
@@ -1210,7 +1189,7 @@ def test_extract_script_files_from_entrypoint_single_script(mocker, tmp_path):
12101189 assert scripts is not None
12111190 assert test_script .name in scripts
12121191 assert scripts [test_script .name ] == "print('Hello World!')"
1213- assert f"/home/ray/scripts /{ test_script .name } " in rayjob .entrypoint
1192+ assert f"{ MOUNT_PATH } /{ test_script .name } " in rayjob .entrypoint
12141193 finally :
12151194 os .chdir (original_cwd )
12161195
@@ -1377,7 +1356,7 @@ def test_add_script_volumes():
13771356 assert volume .config_map .name == "test-scripts"
13781357
13791358 assert mount .name == "ray-job-scripts"
1380- assert mount .mount_path == "/home/ray/scripts"
1359+ assert mount .mount_path == MOUNT_PATH
13811360
13821361
13831362def test_add_script_volumes_duplicate_prevention ():
@@ -1619,7 +1598,7 @@ def test_rayjob_submit_with_scripts_new_cluster(mocker, tmp_path):
16191598 assert len (cluster_config .volume_mounts ) == 1
16201599
16211600 # Verify entrypoint was updated
1622- assert "/home/ray/scripts /test.py" in rayjob .entrypoint
1601+ assert f" { MOUNT_PATH } /test.py" in rayjob .entrypoint
16231602
16241603 finally :
16251604 os .chdir (original_cwd )
@@ -1645,9 +1624,7 @@ def test_process_script_and_imports_io_error(mocker, tmp_path):
16451624 mocker .patch ("builtins.open" , side_effect = IOError ("Permission denied" ))
16461625
16471626 # Should handle the error gracefully and not crash
1648- rayjob ._process_script_and_imports (
1649- "test.py" , scripts , "/home/ray/scripts" , processed_files
1650- )
1627+ rayjob ._process_script_and_imports ("test.py" , scripts , MOUNT_PATH , processed_files )
16511628
16521629 # Should add to processed_files but not to scripts (due to error)
16531630 assert "test.py" in processed_files
@@ -1671,7 +1648,7 @@ def test_process_script_and_imports_container_path_skip(mocker):
16711648
16721649 # Test script path already in container
16731650 rayjob ._process_script_and_imports (
1674- "/home/ray/scripts/ test.py" , scripts , "/home/ray/scripts" , processed_files
1651+ f" { MOUNT_PATH } / test.py" , scripts , MOUNT_PATH , processed_files
16751652 )
16761653
16771654 # Should skip processing
@@ -1695,9 +1672,7 @@ def test_process_script_and_imports_already_processed(mocker, tmp_path):
16951672 processed_files = {"test.py" } # Already processed
16961673
16971674 # Should return early without processing
1698- rayjob ._process_script_and_imports (
1699- "test.py" , scripts , "/home/ray/scripts" , processed_files
1700- )
1675+ rayjob ._process_script_and_imports ("test.py" , scripts , MOUNT_PATH , processed_files )
17011676
17021677 # Should remain unchanged
17031678 assert len (scripts ) == 0
0 commit comments