|
| 1 | +# E2E v2 Directory Reorganization Proposal |
| 2 | + |
| 3 | +## Current Structure Issues |
| 4 | + |
| 5 | +The current structure mixes different organizational principles: |
| 6 | +- **Cluster lifecycle types**: `workspace_clusters/`, `temporary_clusters/`, `lifecycled_clusters/` |
| 7 | +- **Features**: `kueue_integration/`, `secure_trusted_network/` |
| 8 | +- **Miscellaneous**: `other/` (vague category) |
| 9 | + |
| 10 | +This makes it hard to find tests and understand the test suite organization. |
| 11 | + |
| 12 | +## Proposed Structure |
| 13 | + |
| 14 | +Organize by **feature/functionality** as the primary principle, with execution context (remote/in-cluster) clearly separated: |
| 15 | + |
| 16 | +``` |
| 17 | +tests/e2e_v2/ |
| 18 | +├── conftest.py # Pytest configuration and fixtures |
| 19 | +├── __init__.py |
| 20 | +│ |
| 21 | +├── cluster_management/ # Cluster lifecycle and management |
| 22 | +│ ├── workspace/ # Long-running clusters |
| 23 | +│ │ ├── test_ray_init.py # Combines remote + in-cluster |
| 24 | +│ │ └── test_remote_functions.py |
| 25 | +│ ├── temporary/ # Short-lived clusters |
| 26 | +│ │ └── test_rayjob_submission.py |
| 27 | +│ └── lifecycled/ # RayJob-managed clusters |
| 28 | +│ └── test_lifecycled_clusters.py |
| 29 | +│ |
| 30 | +├── kueue/ # Kueue integration tests |
| 31 | +│ ├── test_admission.py |
| 32 | +│ ├── test_queueing.py |
| 33 | +│ └── test_resource_flavors.py |
| 34 | +│ |
| 35 | +├── security/ # Security and network tests |
| 36 | +│ ├── test_oauth.py |
| 37 | +│ ├── test_mtls.py # Combines remote + in-cluster |
| 38 | +│ └── test_network_policies.py |
| 39 | +│ |
| 40 | +├── cluster_config/ # Cluster configuration tests |
| 41 | +│ └── test_heterogeneous.py |
| 42 | +│ |
| 43 | +└── utils/ # Shared utilities |
| 44 | + ├── base_test.py |
| 45 | + ├── helpers.py |
| 46 | + ├── kueue.py |
| 47 | + ├── pod_execution.py |
| 48 | + ├── support.py |
| 49 | + └── scripts/ |
| 50 | +``` |
| 51 | + |
| 52 | +## Alternative: Keep Execution Context Separate |
| 53 | + |
| 54 | +If we want to emphasize the dual execution context pattern: |
| 55 | + |
| 56 | +``` |
| 57 | +tests/e2e_v2/ |
| 58 | +├── conftest.py |
| 59 | +├── __init__.py |
| 60 | +│ |
| 61 | +├── ray_init/ # Feature: ray.init() |
| 62 | +│ ├── test_remote.py # Remote execution context |
| 63 | +│ └── test_in_cluster.py # In-cluster execution context |
| 64 | +│ |
| 65 | +├── rayjob/ # Feature: RayJob submission |
| 66 | +│ ├── test_client_remote.py |
| 67 | +│ ├── test_client_in_cluster.py |
| 68 | +│ └── test_cr_submission.py |
| 69 | +│ |
| 70 | +├── kueue/ # Feature: Kueue integration |
| 71 | +│ ├── test_admission.py |
| 72 | +│ ├── test_queueing.py |
| 73 | +│ └── test_resource_flavors.py |
| 74 | +│ |
| 75 | +├── security/ # Feature: Security |
| 76 | +│ ├── test_oauth.py |
| 77 | +│ ├── test_mtls_remote.py |
| 78 | +│ ├── test_mtls_in_cluster.py |
| 79 | +│ └── test_network_policies.py |
| 80 | +│ |
| 81 | +├── cluster_config/ # Feature: Cluster configuration |
| 82 | +│ └── test_heterogeneous.py |
| 83 | +│ |
| 84 | +└── utils/ |
| 85 | +``` |
| 86 | + |
| 87 | +## Recommendation |
| 88 | + |
| 89 | +**Option 1 (Feature-first)** is recommended because: |
| 90 | +1. ✅ Tests are grouped by what they test (feature/functionality) |
| 91 | +2. ✅ Easier to find tests for a specific feature |
| 92 | +3. ✅ Execution context (remote/in-cluster) can be in the same file or clearly named |
| 93 | +4. ✅ Cluster lifecycle is less important than what functionality is being tested |
| 94 | +5. ✅ Eliminates vague "other/" category |
| 95 | + |
| 96 | +## Migration Plan |
| 97 | + |
| 98 | +1. Create new directory structure |
| 99 | +2. Move files to new locations |
| 100 | +3. Update imports in test files |
| 101 | +4. Update any documentation references |
| 102 | +5. Verify tests still run correctly |
0 commit comments