|
| 1 | + |
| 2 | +# Integration Tests |
| 3 | + |
| 4 | +Automated tests for OAuth2 infrastructure components. |
| 5 | + |
| 6 | +## Running Tests Locally |
| 7 | + |
| 8 | +``` |
| 9 | +
|
| 10 | +chmod +x tests/test_infrastructure.sh |
| 11 | +./tests/test_infrastructure.sh |
| 12 | +
|
| 13 | +``` |
| 14 | + |
| 15 | +## Test Coverage |
| 16 | + |
| 17 | +- ✅ Token storage directory (`/var/lib/hh-token`) |
| 18 | +- ✅ systemd timer configuration (`hh-token-refresh.timer`) |
| 19 | +- ✅ nginx reverse-proxy (`/etc/nginx/sites-available/hh-oauth2`) |
| 20 | +- ✅ Docker image availability (`ghcr.io/do6pbln9l/hh-oauth2-app`) |
| 21 | + |
| 22 | +## Expected Output |
| 23 | + |
| 24 | +``` |
| 25 | +
|
| 26 | +=========================================== |
| 27 | +OAuth2 Infrastructure Integration Tests |
| 28 | +=========================================== |
| 29 | +
|
| 30 | +▶ Running: Token storage directory |
| 31 | +✅ PASS: Token directory exists |
| 32 | +
|
| 33 | +▶ Running: systemd timer configuration |
| 34 | +✅ PASS: systemd timer configured |
| 35 | +
|
| 36 | +▶ Running: nginx reverse-proxy |
| 37 | +✅ PASS: nginx config exists |
| 38 | +
|
| 39 | +▶ Running: Docker image availability |
| 40 | +✅ PASS: Docker image found locally |
| 41 | +
|
| 42 | +=========================================== |
| 43 | +Test Results |
| 44 | +=========================================== |
| 45 | +Tests run: 4 |
| 46 | +Tests passed: 4 |
| 47 | +Tests failed: 0 |
| 48 | +
|
| 49 | +✅ All tests passed! |
| 50 | +
|
| 51 | +``` |
| 52 | + |
| 53 | +## CI/CD Integration |
| 54 | + |
| 55 | +Tests run automatically in GitHub Actions on every push to `main` branch. In CI environment, system-specific checks are skipped. |
| 56 | + |
| 57 | +## Adding New Tests |
| 58 | + |
| 59 | +1. Create test function in `test_infrastructure.sh` |
| 60 | +2. Follow naming convention: `test_<component_name>` |
| 61 | +3. Use `test_start`, `test_pass`, `test_fail` helpers |
| 62 | +4. Add test call to `main()` function |
| 63 | + |
| 64 | +## Test Environment Variables |
| 65 | + |
| 66 | +- `CI=true` - Skips system-specific checks (for GitHub Actions) |
| 67 | + |
0 commit comments