Repository navigation
Executor Module Testing #104
Copy link
Copy link
Closed
Labels
in-progressSomething being actively worked onSomething being actively worked ontaskSub-task of an epicSub-task of an epic
Description
name: "Executor Module Testing"
status: open
created: 2025-09-04T00:46:14Z
updated: 2025-09-04T00:46:14Z
github: [Will be updated when synced to GitHub]
depends_on: []
parallel: true
conflicts_with: []
Description
Implement comprehensive test coverage for the executor module (clustrix/executor.py) focusing on job lifecycle management, SSH connections, and file transfers. The current coverage is 71% and needs to reach 85%+ by testing job submission, monitoring, and result collection workflows.
Acceptance Criteria
- Test coverage for
clustrix/executor.pyreaches 85%+ - Job lifecycle testing (submit → monitor → collect results)
- SSH connection management testing with paramiko mocking
- File transfer operations testing (upload/download via SFTP)
- Job status monitoring for all cluster types (SLURM, PBS, SGE, Kubernetes, SSH)
- Error handling for connection failures and timeouts
- Remote environment setup and cleanup testing
- Result serialization and deserialization testing
- All tests pass in CI/CD pipeline
- No reduction in existing test coverage for other modules
Technical Details
Current Coverage Analysis
- File:
clustrix/executor.py - Current: 71% coverage
- Target: 85%+ coverage
- Focus: Job execution workflow and SSH operations
Key Areas to Test
-
Job Lifecycle Management
- Job submission to different cluster types
- Job status polling and monitoring
- Result collection and cleanup
- Error propagation from remote execution
-
SSH Connection Management
- Connection establishment with paramiko
- Connection pooling and reuse
- Authentication (key-based and password)
- Connection failure and retry logic
-
File Transfer Operations
- SFTP upload of serialized functions and data
- Remote directory creation and management
- Download of results and logs
- File permission and cleanup handling
-
Cluster-Specific Operations
- SLURM job submission and monitoring
- PBS/SGE scheduler integration
- Kubernetes pod management
- SSH-only execution mode
-
Error Scenarios
- Network connectivity issues
- Authentication failures
- Remote execution errors
- Timeout handling
Testing Strategy
- Mock paramiko SSH/SFTP operations for predictable testing
- Use temporary directories for file operation testing
- Mock cluster scheduler commands (sbatch, qsub, kubectl)
- Test concurrent job execution scenarios
- Verify proper resource cleanup in all error paths
Dependencies
- paramiko library for SSH operations
- pytest and pytest-mock for testing framework
- tempfile for temporary directory testing
- Access to existing executor implementation
Effort Estimate
Size: M (3-4 days)
- Research: 0.5 days (understand current executor implementation)
- Test Design: 0.5 days (plan SSH mocking and job lifecycle tests)
- Implementation: 2-2.5 days (write comprehensive executor tests)
- Validation: 0.5-1 day (verify coverage and CI integration)
Definition of Done
- Executor module test coverage ≥ 85%
- Job lifecycle fully tested for all cluster types
- SSH connection and file transfer operations covered
- Error handling and edge cases tested
- All tests pass locally and in CI
- No regression in other module coverage
- Code review completed and approved
- Documentation updated if needed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in-progressSomething being actively worked onSomething being actively worked ontaskSub-task of an epicSub-task of an epic
Activity
Add test coverage epic (Issue #98) with 8 tasks
jeremymanning commentedon Aug 17, 2026
Audit update 2026-08-17 (see #108).
Stale target. The body says "
clustrix/executor.py, 511 lines, 71%". That file is now a 39-line re-export shim (executor.py:19-26). The real logic moved toexecutor_core.py(466),executor_connections.py(389),executor_schedulers.py(378),executor_scheduler_status.py(651),executor_kubernetes.py(461),executor_cloud.py(470).Work exists in unpushed local commits only — see #112.
Blocking problem for this issue: the executor is the single worst place in the codebase for mock-based testing.
executor_scheduler_status.py:89— production code importsunittest.mockand branches onisinstance(ssh_client, Mock), with the comment "Fallback to original logic for unit tests"._check_slurm_job_status_robust— the shipped path — is unreachable from any unit test. (Remove mock-awareness from shipped code (production branches on isinstance(..., Mock)) #116)tests/test_executor_connections.py:72,103,144,190,215,234,253,279,295— every connection test patchesparamiko.SSHClient; the connection manager is never tested against a socket. (Replace assertion-free mock tests with tests that actually execute (2,513 mock occurrences) #117)executor_core.py:210: KeyError: 'manager', and 7 areValueError: Unsupported cluster type: local. (Fix the 127 test failures and 8 collection errors that CI never sees #114)Recommend blocking this on #116 so the tests written here exercise the real path.
Issue #104: Create comprehensive executor_core coordination tests wit…
Issue #104: Add comprehensive ConnectionManager tests
Issue #104: Complete comprehensive scheduler operations tests
Issue #104: Enhance ConnectionManager tests with additional edge cases
Issue #104: Complete Stream 1 (Connection Management) documentation
jeremymanning commentedon Aug 20, 2026
Closed — the file it targets is a shim
clustrix/executor.pywas 511 lines at 71% when this was written. It is now 7 statements at 100% — a backward-compatibility re-export. The implementation lives inexecutor_core.py,executor_connections.py,executor_schedulers.pyandexecutor_scheduler_status.py.The mock-awareness sub-target is also done:
grep -rn "unittest.mock|MagicMock|isinstance(.*Mock" clustrix/returns nothing. The PBS, SGE and Kubernetes sub-targets are moot — those backends are deleted (#140, #141, #142).The genuine remaining gap is
executor_scheduler_status.pyat 49% (128 statements uncovered). That deserves a fresh issue stated against the real file rather than a stale target.