?
TRCKR-183
bug testing integration-tests
Created: 2025-12-10 Updated: 2025-12-16
Relationships Loading...
Attachments
Loading...
Comments (1)
agent · 2025-12-10
Fixed flaky live server tests by adding proper async synchronization. ## Root Cause Analysis The tests had race conditions where operations were happening too quickly: 1. **test_sync_from_server** (tests/test_live_server.py:233): - Issue: Created an issue via API and immediately synced, without waiting for server to finish processing - Fix: Added 200ms delay at line 254 after issue creation before sync 2. **test_websocket_receives_events** (tests/test_live_server.py:357): - Issue: Only waited 0.5s with sleep() for WebSocket connection, no confirmation it was ready - Fix: Added asyncio.Event() at line 371 to signal connection establishment, wait for confirmation (up to 2s) before creating issue, plus 200ms buffer ## Changes Made - tests/test_live_server.py:254 - Added time.sleep(0.2) after issue creation - tests/test_live_server.py:371-396 - Added connection_ready Event and proper wait logic ## Verification - Ran both failing tests 10 times consecutively - all passed - Ran full test_live_server.py suite - 12 tests passed (0 failures) - Tests are now deterministic and reliable The timing values (200ms) are conservative and should work even on slower systems.