red-accountant-48215
07/23/2025, 9:24 AMtall-airline-16756
07/23/2025, 9:24 AMtall-airline-16756
07/23/2025, 9:25 AMFakeTTS class to trigger specific failure scenarios, such as timeouts, exceptions, or no audio generation. For example:
fake_tts = FakeTTS(fake_timeout=0.5) # Simulate timeout
fake_tts = FakeTTS(fake_exception=RuntimeError("test error")) # Simulate exception
fake_tts = FakeTTS(fake_audio_duration=0.0) # Simulate no audio
• Test network failures with Toxiproxy: Use Toxiproxy to simulate network-level issues like timeouts or dropped connections.
p = toxiproxy.create(proxy_upstream, proxy_name, listen=PROXY_LISTEN, enabled=True)
p.add_toxic(type="timeout", attributes={"timeout": 0})
• Verify error propagation and fallback: Write tests to ensure errors are correctly raised and fallback adapters are triggered when the primary TTS service fails.
• Test retry and recovery: Configure retry logic and verify that the system retries on failure and recovers when the TTS service becomes available again.
• JavaScript/TypeScript support: Use the @livekit/agents-plugins-test package for similar TTS failure testing in JS/TS projects.
These approaches allow you to comprehensively test TTS failure handling, fallback, and recovery in your LiveKit applications.
Sources: livekit-agents/livekit/agents/tts/tts.py | plugins/resemble/src/tts.test.tsred-accountant-48215
07/23/2025, 9:31 AMtall-airline-16756
07/23/2025, 9:32 AM