|
|
2 viikkoa sitten | |
|---|---|---|
| .. | ||
| README.md | 2 viikkoa sitten | |
| conftest.py | 2 viikkoa sitten | |
| test_authenticator.py | 2 viikkoa sitten | |
| test_connection.py | 2 viikkoa sitten | |
| test_message.py | 2 viikkoa sitten | |
| test_patricia_trie.py | 2 viikkoa sitten | |
| test_proxy_server.py | 2 viikkoa sitten | |
| test_server_federation.py | 2 viikkoa sitten | |
| test_websocket_bench.py | 2 viikkoa sitten | |
This directory contains tests for the WebSocket proxy functionality.
pytest tests/ -v
pytest tests/test_websocket_bench.py::TestProxyBasicFunctionality -v
pytest tests/test_websocket_bench.py::TestProxyThroughput -v
pytest tests/test_websocket_bench.py::TestProxyLatency -v
pytest tests/test_websocket_bench.py::TestProxyBasicFunctionality::test_single_get_request -v
Tests the binary message protocol serialization/deserialization.
Tests server-to-server federation:
Tests the proxy over WebSocket tunnel functionality with pytest:
test_single_get_request: Verifies basic GET request workstest_single_post_request: Verifies POST request with payload workstest_concurrent_requests: Tests concurrent request handlingtest_small_payload_throughput: Tests with 512B payload
test_large_payload_throughput: Tests with 8KB payload
test_request_latency_distribution: Measures latency distribution
Based on testing, here are reasonable performance targets:
| Metric | Target | Reason |
|---|---|---|
| GET request (cold) | < 1s | Should complete quickly |
| GET request (warm) | < 500ms | After connection established |
| POST request (small) | < 500ms | 1KB payload |
| POST request (large) | < 1s | 8KB payload |
| Throughput (small) | >= 1 MB/s | 10 concurrent, 512B payload |
| Throughput (large) | >= 0.5 MB/s | 5 concurrent, 8KB payload |
| P50 latency | < 200ms | 95% of requests should be fast |
The standalone benchmark script at benchmarks/websocket_bench.py is deprecated.
For ad-hoc testing, you can still use it, but pytest-based tests are recommended.
# Old way (still works):
python -m benchmarks.websocket_bench --requests 100 --concurrency 10
# New recommended way:
pytest tests/test_websocket_bench.py -v
The tests use pytest fixtures for proper setup and teardown:
proxy_infrastructure: Sets up complete proxy stack
test_http_server: Simple HTTP server for receiving requests
response_size parameter