README.mdā¢3.41 kB
# ProxmoxMCP Test Scripts
This folder contains various test scripts and demo programs for the ProxmoxMCP project.
## š File Description
### š§ VM Management Tests
- **`test_vm_power.py`** - VM power management functionality test
- Test VM start, stop, restart and other operations
- Check VM status and available operations
- **`test_vm_start.py`** - VM startup functionality specific test
- Dedicated test for VM startup functionality
- Suitable for single VM startup testing
- **`test_create_vm.py`** - VM creation functionality test
- Test complete workflow of creating new virtual machines
- Verify 1 CPU core + 2GB RAM + 10GB storage configuration
### š API Tests
- **`test_openapi.py`** - OpenAPI service comprehensive test
- Test all API endpoints
- Include VM creation, power management and other functionalities
- Verify integration with Open WebUI
## š Usage
### Environment Setup
```bash
# Activate virtual environment
source ../.venv/bin/activate
# Set configuration path (if needed)
export PROXMOX_MCP_CONFIG=../proxmox-config/config.json
```
### Running Tests
#### 1. Test VM Power Management
```bash
python test_vm_power.py
```
#### 2. Test VM Creation
```bash
python test_create_vm.py
```
#### 3. Test OpenAPI Service
```bash
python test_openapi.py
```
#### 4. Test VM Startup
```bash
python test_vm_start.py
```
## š Test Coverage
### ā
Tested Features
- [x] VM list retrieval
- [x] VM status query
- [x] VM power management (start/stop/restart/shutdown)
- [x] VM creation (support custom CPU/memory/storage)
- [x] Storage type auto-detection
- [x] Disk format intelligent selection
- [x] OpenAPI service integration
- [x] Error handling verification
### šÆ Test Scenarios
- **Basic functionality**: Connection, authentication, basic operations
- **VM lifecycle**: Create, start, stop, delete
- **Storage compatibility**: LVM, filesystem storage
- **API integration**: REST API calls and responses
- **Error recovery**: Exception handling
## š Related Documentation
- **Main project documentation**: [../README.md](../README.md)
- **VM creation guide**: [../VM_CREATION_GUIDE.md](../VM_CREATION_GUIDE.md)
- **OpenAPI deployment**: [../OPENAPI_DEPLOYMENT.md](../OPENAPI_DEPLOYMENT.md)
- **Quick deployment**: [../QUICK_DEPLOY_8811.md](../QUICK_DEPLOY_8811.md)
## š Test Results Examples
### Success Cases
```
ā
VM 995: Created successfully (local-lvm, raw)
ā
VM 996: Created successfully (vm-storage, raw)
ā
VM 998: Created successfully (local-lvm, raw)
ā
VM 999: Created successfully (local-lvm, raw)
```
### API Endpoint Verification
```
ā
get_nodes: 200 - 134 chars
ā
get_vms: 200 - 1843 chars
ā
create_vm: 200 - VM created successfully
ā
start_vm: 200 - VM started successfully
```
## š ļø Troubleshooting
If tests fail, please check:
1. **Configuration file**: Whether `../proxmox-config/config.json` is correct
2. **Network connection**: Whether Proxmox server is reachable
3. **Authentication info**: Whether API token is valid
4. **Service status**: Whether OpenAPI service is running on port 8811
## š Contributing Guidelines
When adding new tests, please:
1. Use descriptive filenames (e.g., `test_function_name.py`)
2. Include detailed docstrings
3. Add appropriate error handling
4. Update this README file
---
**Last Updated**: December 2024
**Maintainer**: ProxmoxMCP Development Team