# Manual Testing Guide for Caddy-RS File Sync ## Test Setup Complete ✅ The automated tests confirm: - ✅ Server builds and starts successfully - ✅ All API endpoints (`/api/list`, `/api/download`, `/api/upload`, `/api/metadata`) work - ✅ File upload/download functionality verified - ✅ Configuration parsing works correctly ## Manual Testing Steps ### 1. Start the Server ```bash cargo run --release -- -c example-sync-config.json ``` Server will start on `http://localhost:8080` with sync data in `./sync-data/` ### 2. Test API Directly (Optional) ```bash # List all files curl http://localhost:8080/api/list | jq . # Download a specific file curl "http://localhost:8080/api/download?path=README.md" # Upload a test file echo "Test upload" | curl -X POST "http://localhost:8080/api/upload?path=test.txt" \ -H "Content-Type: application/octet-stream" --data-binary @- # Get file metadata curl "http://localhost:8080/api/metadata?path=README.md" | jq . ``` ### 3. Test Sync Client In a **new terminal window**: ```bash # Create client directory mkdir -p ./my-sync-test # Start sync client with initial sync cargo run --bin sync-client -- \ --server http://localhost:8080 \ --local-path ./my-sync-test \ --initial-sync ``` **Expected behavior:** 1. Client downloads all server files initially 2. Client starts watching `./my-sync-test/` for changes 3. Syncs bidirectionally every 30 seconds ### 4. Test Bidirectional Sync **While sync client is running:** **Test 1: Client → Server** ```bash # In third terminal, create file on client side echo "Hello from client" > ./my-sync-test/client-file.txt # Wait 30+ seconds, then check server directory ls ./sync-data/client-file.txt # Should exist ``` **Test 2: Server → Client** ```bash # Create file on server side echo "Hello from server" > ./sync-data/server-file.txt # Wait 30+ seconds, then check client directory ls ./my-sync-test/server-file.txt # Should exist ``` ### 5. Test Real-time File Watching With sync client running, the logs should show: - `"File operation detected"` when you create/modify/delete files - `"Starting sync cycle"` every 30 seconds - `"Sync successful"` after each sync operation ### 6. Test Conflict Resolution **Create a conflict:** 1. Create file on both sides: `echo "Client version" > ./my-sync-test/conflict.txt` 2. And: `echo "Server version" > ./sync-data/conflict.txt` 3. Wait for sync cycle 4. Check logs for conflict detection ## Test Files Created The test setup created these files in `./sync-data/`: - `README.md` - Main test file - `documents/hello.txt` - Text file for testing - `documents/notes.md` - Markdown with test scenarios - `config.json` - JSON configuration test - Various test directories ## Success Criteria ✅ **Basic functionality:** - Server starts without errors - API endpoints respond correctly - File upload/download works ✅ **Sync functionality:** - Initial sync downloads all files - Client detects local file changes - Files sync bidirectionally - Directory structure is preserved - SHA-256 integrity verification works 🔄 **Next level features (future):** - Real-time sync via WebSocket - Web interface for file management - Advanced conflict resolution - Delta sync for large files ## Troubleshooting **Server won't start:** - Check port 8080 isn't in use: `lsof -i :8080` - Verify config file exists: `ls example-sync-config.json` **Client sync issues:** - Ensure server is running first - Check network connectivity: `curl http://localhost:8080/api/list` - Verify permissions on sync directories **Files not syncing:** - Check sync client logs for errors - Verify file watcher is detecting changes - Wait for full sync cycle (30+ seconds) ## Performance Notes - Initial sync may take time for large directories - File watching has slight delay for debouncing - Large files are transferred completely (no delta sync yet) - Memory usage scales with number of files being watched --- **Status: Ready for manual testing and development of next features!**