docs(websockets): add infrastructure requirements and troubleshooting to guides
This commit is contained in:
@@ -86,5 +86,15 @@ Always run test scripts from the **project root** directory. Most scripts includ
|
||||
```
|
||||
(Note: Restarts are NOT necessary if you are only modifying the test scripts themselves).
|
||||
3. **Clean Up**: Clean up any temporary or debug files created during testing. However, **keep your test scripts**! Refactor them slightly for future use and clarity so they remain valuable assets for the project.
|
||||
4. **Stay Current**: Update this `README.md` when you add new tests or learn something that could help others. This is a living document; keep the **Script Inventory** and tips up to date.
|
||||
5. **Commit Often**: Don't forget to commit your working code and tests before moving on to the next task!
|
||||
4. **Host Header Routing**: When testing through the Nginx gateway (port 5060), ensure your client uses a recognized Host header (e.g., `fastapi.localhost`). Nginx uses this to decide which proxy block to use.
|
||||
5. **Stay Current**: Update this `README.md` when you add new tests or learn something that could help others. This is a living document; keep the **Script Inventory** and tips up to date.
|
||||
6. **Commit Often**: Don't forget to commit your working code and tests before moving on to the next task!
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Troubleshooting Common Test Errors
|
||||
|
||||
- **HTTP 404 (WebSockets)**: Nginx doesn't recognize the path. Check the `location` blocks in the Nginx `.conf` files.
|
||||
- **HTTP 400 (WebSockets)**: Usually a Host header mismatch. Nginx is hitting the default "localhost" block instead of the API proxy.
|
||||
- **Connection Refused (Redis)**: The script is likely running on the host but trying to hit `localhost:6379` while Redis is only reachable inside the Docker network or mapped to a different port.
|
||||
- **Hanging Scripts**: If using `TestClient` with multiple WebSockets, the script may dead-lock. Use an asynchronous library like `websockets` or `httpx` for multi-client tests.
|
||||
|
||||
Reference in New Issue
Block a user