π§ͺTesting Guide
This document describes the comprehensive testing capabilities available in ProxmoxMCP through the enhanced Taskfile.yml configuration.
Overview
ProxmoxMCP provides a sophisticated testing workflow that supports different testing scenarios, intelligent dependency management, and developer-friendly output. The testing system is designed to accommodate both rapid development cycles and comprehensive validation.
Testing Tasks
Primary Testing Commands
task test
task testDescription: Run all tests with enhanced validation and informative output.
task testFeatures:
Comprehensive test suite execution (71 tests)
Enhanced output with progress indicators
Improved error reporting with
--tb=shortClear completion summary
Use Cases:
Pre-commit validation
Full codebase testing
CI/CD pipeline execution
task test:unit
task test:unitDescription: Run unit tests only with focused output.
Features:
Explicit unit test execution
Focused on
tests/directoryShort traceback format for faster debugging
Use Cases:
Development workflow testing
Quick validation during coding
Focused debugging sessions
Specialized Testing Commands
task test:coverage
task test:coverageDescription: Run tests with coverage reporting (intelligent dependency handling).
Features:
Automatic pytest-cov detection
Graceful fallback when coverage tools unavailable
HTML and terminal coverage reports
80% coverage threshold enforcement
Helpful installation guidance
Dependencies:
Use Cases:
Code coverage analysis
Quality assurance validation
Identifying untested code paths
task test:watch
task test:watchDescription: Run tests in watch mode for continuous development.
Features:
Automatic pytest-watch detection
Graceful fallback to single test run
Installation guidance for watch mode
Continuous testing during development
Dependencies:
Use Cases:
Test-driven development (TDD)
Continuous validation during coding
Rapid feedback loops
task test:security
task test:securityDescription: Run security-focused test subset.
Features:
Filters tests with security keywords (
encrypt,security,auth)Focuses on authentication and encryption functionality
Faster execution for security validation
42 security-related tests
Use Cases:
Security-focused development
Encryption feature validation
Authentication flow testing
task test:tools
task test:toolsDescription: Run MCP tools tests.
Features:
Tests MCP server functionality
Validates VM console operations
Focuses on tool implementations
Quick validation of MCP protocol compliance
Use Cases:
MCP tool development
API integration validation
Tool functionality verification
task test:config
task test:configDescription: Run configuration and encryption tests.
Features:
Tests configuration loading and validation
Validates encryption/decryption functionality
Focuses on config management
Covers 42 configuration-related tests
Use Cases:
Configuration system development
Encryption feature development
Config validation testing
task test:integration
task test:integrationDescription: Placeholder for integration tests (future implementation).
Features:
Guidance for integration test setup
Proxmox connection requirements
Future implementation roadmap
Clear setup instructions
Use Cases:
End-to-end testing (when implemented)
Real Proxmox API validation
Integration verification
Testing Workflow Patterns
Development Workflow
Rapid Development Cycle
Pre-Commit Workflow
Coverage Analysis Workflow
CI/CD Integration
Local CI Simulation
Component-Specific Testing
Test Configuration
Pytest Configuration
Located in pyproject.toml:
Test Discovery
Test Directory:
tests/Test Files:
test_*.pyTest Functions:
test_*Async Support: Full async/await support enabled
Current Test Coverage
Covered Components (71 tests)
β Configuration loading and validation
β Encryption and security functionality
β MCP server implementation
β VM console operations
β Authentication flows
Components Needing Coverage (Future)
β AI diagnostic tools (
tools/ai_diagnostics.py)β Formatting modules (
formatting/)β Core Proxmox functionality (
core/proxmox.py)β Additional tool modules (
tools/node.py,tools/storage.py, etc.)
Intelligent Dependency Management
Automatic Dependency Detection
The testing system automatically detects optional dependencies and provides helpful fallbacks:
pytest-cov Detection
pytest-watch Detection
Installation Commands
When dependencies are missing, the system provides exact installation commands:
Integration with Development Tools
VS Code Integration
The testing workflow integrates seamlessly with VS Code:
Test discovery works automatically
Debugging support for individual tests
Coverage highlighting with coverage extensions
Git Hooks Integration
Testing is integrated into git workflows:
Pre-commit hooks run quality checks
Push hooks can run full test suite
CI/CD integration validates all changes
Docker Integration
Testing works in Docker environments:
Performance Considerations
Test Execution Times
Full test suite: ~6-8 seconds (71 tests)
Security subset: ~2-3 seconds (42 tests)
Tools subset: ~1-2 seconds (focused tests)
Config subset: ~3-4 seconds (42 tests)
Optimization Strategies
Use focused test subsets during development
Leverage watch mode for continuous testing
Run full suite only for pre-commit/CI
Use coverage analysis periodically, not continuously
Troubleshooting
Common Issues
Tests Not Found
Missing Dependencies
Coverage Tool Issues
Async Test Issues
Environment Issues
PYTHONPATH Configuration
The Taskfile automatically configures PYTHONPATH:
Virtual Environment
Ensure you're using the correct environment:
Future Enhancements
Planned Improvements
Integration test implementation
Performance benchmarking
Load testing capabilities
Enhanced security testing
API contract testing
Roadmap Alignment
Testing improvements align with project roadmap:
Phase 1: Core component coverage expansion
Phase 2: Integration testing implementation
Phase 3: Performance and load testing
Phase 4: Advanced security testing
For detailed future improvements, see GitHub Issue #75.
Best Practices
Development Testing
Use
task test:watchduring active developmentRun focused subsets (
test:security,test:tools) for quick feedbackUse
task test:coverageperiodically to identify coverage gapsRun
task pre-commitbefore committing changes
CI/CD Testing
Use
task cifor comprehensive local validationEnsure all dependencies are properly locked in
uv.lockTest in clean environments to catch dependency issues
Monitor test execution times and optimize as needed
Team Collaboration
Share testing patterns and workflows with team members
Document any new test categories or patterns
Keep testing dependencies up to date
Contribute to test coverage improvements
This comprehensive testing workflow ensures high code quality, rapid development feedback, and reliable validation of ProxmoxMCP functionality across all components.
Last updated
Was this helpful?