- Files Modified:
Models/AutoScalerConfiguration.cs: AddedMinVmIdproperty with default value 5000CloudControllers/ProxmoxCloudController.cs: Modified to use configurable MinVmId instead of hardcoded constantProgram.cs: Updated controller instantiation to pass MinVmId from configuration
- Project Structure:
GithubActionsOrchestrator.IntegrationTests/ ├── GithubActionsOrchestrator.IntegrationTests.csproj ├── ProxmoxCloudControllerIntegrationTests.cs ├── TestConfiguration/ │ └── TestAutoScalerConfiguration.cs ├── Fixtures/ │ └── ProxmoxTestFixture.cs ├── appsettings.test.json ├── README.md └── run-tests.sh (executable)
- VM ID Range Isolation: Tests use 20000+ range vs production 5000-15000
- Runner Prefix Isolation: Tests use
"ghr-test"vs production"ghr" - Configuration Validation: Prevents accidental production usage
- Automatic Cleanup: All test VMs tracked and deleted after tests
- Environment Variable Validation: Ensures required Proxmox settings
-
Core Operations:
- VM creation with correct properties and ID allocation
- VM deletion and cleanup
- Server listing and counting (filtered by test prefix)
- Authentication and API calls
-
Advanced Scenarios:
- Custom profile support
- Multiple VM creation with unique IDs
- Provision payload validation
- Error handling for invalid configurations
-
Configuration Validation in ProxmoxCloudController:
- MinVmId must be >= 1000
- PVE credentials cannot be empty
- Logs allocated VM IDs for audit trail
-
Test Environment Protection:
- Cannot run with production prefix "ghr"
- Test VM ID range must be >= 20000
- Required environment variables validation
export PVE_HOST="your-proxmox-host.com"
export PVE_USERNAME="root@pam"
export PVE_PASSWORD="your-password"
# Optional overrides
export TEST_RUNNER_PREFIX="ghr-test" # Default: ghr-test
export TEST_MIN_VM_ID="20000" # Default: 20000
export TEST_PVE_TEMPLATE="100" # Default: 100cd GithubActionsOrchestrator.IntegrationTests
# Run all tests
./run-tests.sh
# Run with verbose output
./run-tests.sh --verbose
# Run specific tests
./run-tests.sh --filter "CreateNewRunner*"
# Or using dotnet directly
dotnet test GithubActionsOrchestrator.IntegrationTests.csproj- VM ID Range: Test VMs use 20000+ vs production 5000-15000
- Naming: Test VMs prefixed with "ghr-test" vs production "ghr"
- Validation: Built-in checks prevent production conflicts
- All created VMs are tracked during tests
- Automatic deletion on test completion
- Disposal pattern ensures cleanup even if tests fail
- Manual verification recommended for orphaned VMs
- Production settings detection and rejection
- Required environment variable validation
- MinVmId range enforcement (>= 20000 for tests)
- Proxmox connectivity verification
When properly configured, all tests should pass:
- ✅ 9 integration tests covering all major operations
- ✅ VM creation in isolated ID range (20000+)
- ✅ Proper naming with test prefix ("ghr-test-*")
- ✅ Automatic VM cleanup after tests
- ✅ Configuration validation and safety checks
- Environment Variables: Ensure PVE_HOST, PVE_USERNAME, PVE_PASSWORD are set
- Network Access: Test runner needs connectivity to Proxmox API (port 8006)
- Template VM: Ensure template VM ID exists in Proxmox (default: 100)
- Permissions: PVE user needs VM management permissions
- ID Range: Test VM IDs must be available in 20000+ range
- EF Core version conflicts are expected and non-critical
- Migration naming warnings don't affect test functionality
- Logger hiding warnings in HetznerCloudController are existing issues
The integration tests are ready for use and provide comprehensive coverage of ProxmoxCloudController functionality with full production safety measures.