@@ -49,7 +49,7 @@ def test_pihole_ftl_architecture(docker):
4949 assert platform in func .stdout
5050
5151
52- # Wait 5 seconds for startup , then stop the container gracefully
52+ # Wait for FTL to start up , then stop the container gracefully
5353# Finally, check the container logs to see if FTL was shut down cleanly
5454def test_pihole_ftl_clean_shutdown (docker ):
5555 import subprocess
@@ -58,8 +58,23 @@ def test_pihole_ftl_clean_shutdown(docker):
5858 # Get the container ID from the docker fixture
5959 container_id = docker .backend .name
6060
61- # Wait for startup
62- time .sleep (5 )
61+ # Wait for FTL to fully start up by checking logs
62+ max_wait_time = 60 # Maximum wait time in seconds
63+ start_time = time .time ()
64+ ftl_started = False
65+
66+ while time .time () - start_time < max_wait_time :
67+ result = subprocess .run (
68+ ["docker" , "logs" , container_id ], capture_output = True , text = True
69+ )
70+
71+ if "########## FTL started" in result .stdout :
72+ ftl_started = True
73+ break
74+
75+ time .sleep (1 ) # Check every second
76+
77+ assert ftl_started , f"FTL did not start within { max_wait_time } seconds"
6378
6479 # Stop the container gracefully (sends SIGTERM)
6580 subprocess .run (["docker" , "stop" , container_id ], check = True )
0 commit comments