|
| 1 | +--- |
| 2 | +mode: agent |
| 3 | +--- |
| 4 | + |
| 5 | +# Integration Testing Guide Execution Instructions |
| 6 | + |
| 7 | +As an expert system administrator, you will execute the **complete integration testing process** following the [Integration Testing Guide](../../docs/guides/integration-testing-guide.md). |
| 8 | + |
| 9 | +## 📋 Overview |
| 10 | + |
| 11 | +This guide performs a **full end-to-end integration test** that includes: |
| 12 | + |
| 13 | +1. **Clean existing state** (VM, application data, certificates) |
| 14 | +2. **Deploy fresh infrastructure** (VM with Ubuntu 24.04) |
| 15 | +3. **Wait for cloud-init completion** (system provisioning) |
| 16 | +4. **Run comprehensive integration tests** (services, connectivity, functionality) |
| 17 | +5. **Perform smoke testing** (external validation with official client tools) |
| 18 | +6. **Clean up resources** (return to clean state) |
| 19 | + |
| 20 | +**Expected Duration**: ~8-12 minutes total |
| 21 | +**Prerequisites**: Must have completed initial setup (`make test-prereq`) |
| 22 | + |
| 23 | +## 🎯 Execution Requirements |
| 24 | + |
| 25 | +### CRITICAL Rules to Follow: |
| 26 | + |
| 27 | +1. **Sequential Execution**: Follow steps in exact order - do NOT skip or reorder |
| 28 | +2. **No Command Modifications**: Execute commands exactly as written in the guide |
| 29 | +3. **Working Directory**: Always run from project root directory |
| 30 | +4. **Error Handling**: Document any failures or deviations immediately |
| 31 | +5. **Complete Process**: Execute the entire guide from start to finish |
| 32 | + |
| 33 | +### What Gets Cleaned (Destructive Operations): |
| 34 | + |
| 35 | +- **Virtual Machine**: Complete VM destruction and recreation |
| 36 | +- **Application Storage**: Database, SSL certificates, configuration files |
| 37 | +- **OpenTofu State**: Infrastructure state reset |
| 38 | +- **libvirt Resources**: VM disks, cloud-init ISOs, network configurations |
| 39 | + |
| 40 | +## 📝 Step-by-Step Instructions |
| 41 | + |
| 42 | +### Phase 1: Preparation and Cleanup |
| 43 | + |
| 44 | +- **Step 1.1-1.8**: Clean existing infrastructure and application state |
| 45 | +- **Critical**: Step 1.8 (Clean Application Storage) is destructive but recommended |
| 46 | +- **Outcome**: Clean slate for fresh deployment |
| 47 | + |
| 48 | +### Phase 2: Infrastructure Deployment |
| 49 | + |
| 50 | +- **Step 2.1-2.4**: Deploy VM with OpenTofu/Terraform |
| 51 | +- **Critical**: Wait for cloud-init completion (Step 3) |
| 52 | +- **Outcome**: Provisioned VM with Torrust Tracker ready |
| 53 | + |
| 54 | +### Phase 3: Integration Testing |
| 55 | + |
| 56 | +- **Step 4**: Run comprehensive integration tests |
| 57 | +- **Step 5**: Optional manual verification |
| 58 | +- **Step 6**: Optional performance testing |
| 59 | +- **Outcome**: Validated working system |
| 60 | + |
| 61 | +### Phase 4: External Validation |
| 62 | + |
| 63 | +- **Step 7**: External smoke testing with official client tools |
| 64 | +- **Reference**: Use [Smoke Testing Guide](../../docs/guides/smoke-testing-guide.md) for details |
| 65 | +- **Outcome**: Black-box validation of tracker functionality |
| 66 | + |
| 67 | +### Phase 5: Cleanup |
| 68 | + |
| 69 | +- **Step 8**: Clean up all resources |
| 70 | +- **Step 9**: Review insights and best practices |
| 71 | +- **Outcome**: Return to clean state |
| 72 | + |
| 73 | +## 🚨 Important Notes |
| 74 | + |
| 75 | +### SSH Key Configuration |
| 76 | + |
| 77 | +- **Required**: Must configure SSH keys before deployment |
| 78 | +- **Location**: `infrastructure/terraform/local.tfvars` |
| 79 | +- **Template**: Available in `infrastructure/terraform/terraform.tfvars.example` |
| 80 | + |
| 81 | +### Cloud-Init Wait Time |
| 82 | + |
| 83 | +- **Critical**: DO NOT skip Step 3 (cloud-init completion) |
| 84 | +- **Duration**: 2-3 minutes typically |
| 85 | +- **Failure Mode**: SSH connection failures if rushed |
| 86 | + |
| 87 | +### Error Documentation |
| 88 | + |
| 89 | +- **Immediate**: Document any command failures or unexpected outputs |
| 90 | +- **Location**: Add issues directly to the integration testing guide |
| 91 | +- **Format**: Include error messages, context, and resolution steps |
| 92 | + |
| 93 | +### Non-Standard Commands |
| 94 | + |
| 95 | +- **Approval Required**: Only execute commands not in the guide if absolutely necessary |
| 96 | +- **Documentation**: Clearly indicate when deviating from guide |
| 97 | +- **Justification**: Explain why the deviation was needed |
| 98 | + |
| 99 | +## 🔧 Troubleshooting Guidance |
| 100 | + |
| 101 | +### Common Issues and Solutions: |
| 102 | + |
| 103 | +1. **"Command not found"**: Verify you're in project root directory |
| 104 | +2. **SSH connection failures**: Ensure cloud-init has completed |
| 105 | +3. **libvirt permission errors**: Check user is in libvirt group |
| 106 | +4. **VM deployment timeouts**: Normal during cloud-init, wait longer |
| 107 | +5. **Storage volume conflicts**: Run manual cleanup steps from guide |
| 108 | + |
| 109 | +### When to Deviate from Guide: |
| 110 | + |
| 111 | +- **System-specific issues**: Different Linux distributions may need adjustments |
| 112 | +- **Network configuration**: Firewall or DNS issues requiring resolution |
| 113 | +- **Permission problems**: User/group configuration fixes |
| 114 | +- **Always document**: Any deviations with full explanation |
| 115 | + |
| 116 | +## 📊 Success Criteria |
| 117 | + |
| 118 | +### Integration Test Success Indicators: |
| 119 | + |
| 120 | +- ✅ All services start successfully (Docker Compose) |
| 121 | +- ✅ Tracker responds to UDP/HTTP requests |
| 122 | +- ✅ API endpoints return expected data |
| 123 | +- ✅ Grafana dashboards display metrics |
| 124 | +- ✅ MySQL database is accessible and functional |
| 125 | + |
| 126 | +### Smoke Test Success Indicators: |
| 127 | + |
| 128 | +- ✅ UDP tracker clients receive responses |
| 129 | +- ✅ HTTP tracker clients receive responses |
| 130 | +- ✅ API health checks return "Ok" |
| 131 | +- ✅ Statistics endpoints return valid data |
| 132 | +- ✅ Metrics endpoints return Prometheus data |
| 133 | + |
| 134 | +## 🎯 Final Deliverables |
| 135 | + |
| 136 | +Upon completion, you should have: |
| 137 | + |
| 138 | +1. **Executed Complete Guide**: All steps from 1.1 through 9 |
| 139 | +2. **Documented Issues**: Any problems encountered and how they were resolved |
| 140 | +3. **Validated Functionality**: Both integration and smoke tests passed |
| 141 | +4. **Clean State**: All resources cleaned up and ready for next test |
| 142 | +5. **Updated Documentation**: Any guide improvements or corrections needed |
| 143 | + |
| 144 | +## 📖 Additional Resources |
| 145 | + |
| 146 | +- **Integration Testing Guide**: [docs/guides/integration-testing-guide.md](../../docs/guides/integration-testing-guide.md) |
| 147 | +- **Smoke Testing Guide**: [docs/guides/smoke-testing-guide.md](../../docs/guides/smoke-testing-guide.md) |
| 148 | +- **Quick Start Guide**: [docs/infrastructure/quick-start.md](../../docs/infrastructure/quick-start.md) |
| 149 | +- **Troubleshooting**: See infrastructure documentation for libvirt and OpenTofu issues |
| 150 | + |
| 151 | +--- |
| 152 | + |
| 153 | +**Remember**: This is a comprehensive test that validates the entire deployment pipeline. Take your time, follow each step carefully, and document everything for future improvements. |
0 commit comments