FastLED 3.10.6
Loading...
Searching...
No Matches

◆ main()

int test_stress.main ( )

Definition at line 274 of file test_stress.py.

274def main() -> int:
275 parser = argparse.ArgumentParser(
276 description="Stress test FastLED Network HTTP server"
277 )
278 parser.add_argument("--host", default="localhost", help="Server host")
279 parser.add_argument("--port", type=int, default=8080, help="Server port")
280 parser.add_argument(
281 "--connections", type=int, default=20, help="Number of concurrent connections"
282 )
283 parser.add_argument(
284 "--requests", type=int, default=50, help="Number of sequential requests"
285 )
286 args = parser.parse_args()
287
288 config = StressTestConfig(
289 host=args.host,
290 port=args.port,
291 num_connections=args.connections,
292 num_requests=args.requests,
293 )
294
295 console.print("[bold]FastLED Network HTTP Server - Phase 3 Stress Test[/bold]")
296 console.print(f"Server: http://{config.host}:{config.port}\n")
297
298 console.print("[cyan]Starting server...[/cyan]")
299 server_proc = start_server(config)
300 console.print("[green]✓ Server started and responding[/green]")
301
302 results = StressTestResults()
303
304 try:
305 # Test 1: Concurrent connections
306 stress_test_concurrent(config, results)
307
308 # Test 2: Rapid sequential requests
309 stress_test_rapid(config, results)
310
311 # Display results
312 exit_code = display_results(results)
313
314 return exit_code
315
316 except KeyboardInterrupt:
317 console.print("\n[yellow]Test interrupted by user[/yellow]")
318 _thread.interrupt_main()
319 return 130
320
321 finally:
322 console.print("\n[cyan]Stopping server...[/cyan]")
323 server_proc.terminate()
324 try:
325 server_proc.wait(timeout=5)
326 except TimeoutError:
327 # RunningProcess.wait(timeout=) already killed the process.
328 server_proc.kill()
329 console.print("[green]✓ Server stopped[/green]")
330
331

References display_results(), main(), start_server(), stress_test_concurrent(), and stress_test_rapid().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: