5555TB_URL : str = ENV ("SDK_BLACKBOX_TB_URL" , f"{ TB_HTTP_PROTOCOL } ://{ TB_HOST } :{ TB_HTTP_PORT } " )
5656
5757REQUEST_TIMEOUT : float = float (ENV ("SDK_BLACKBOX_HTTP_TIMEOUT" , "30" ))
58- DOCKER_START_TIMEOUT_S : int = int (ENV ("SDK_BLACKBOX_TB_START_TIMEOUT" , "180" ))
58+ TB_START_TIMEOUT : int = int (ENV ("SDK_BLACKBOX_TB_START_TIMEOUT" , "180" ))
5959
6060logger = logging .getLogger ("blackbox" )
6161logger .setLevel (logging .INFO )
@@ -128,7 +128,7 @@ def _wait_for_tb_ready(http: requests.Session) -> None:
128128 start = time .time ()
129129 delay = 1.0
130130 # Try login to ensure full readiness (DB + REST).
131- while time .time () - start < DOCKER_START_TIMEOUT_S :
131+ while time .time () - start < TB_START_TIMEOUT :
132132 try :
133133 r = http .post (
134134 f"{ TB_URL } /api/auth/login" ,
@@ -152,6 +152,7 @@ def start_thingsboard(http: requests.Session) -> Generator[None, None, None]:
152152 Ensures instance is ready. If we start the container, we will stop it at session end.
153153 """
154154 if not RUN_BLACKBOX :
155+ _wait_for_tb_ready (http )
155156 yield
156157 return
157158
@@ -480,7 +481,7 @@ def device_profile_with_rpc_rule_chain(
480481 http : requests .Session ,
481482) -> Generator [dict , None , None ]:
482483 """
483- Creates a device profile that uses the RPC rule chain as default; cleans up afterwards .
484+ Creates a device profile that uses the RPC rule chain as default; cleans up afterward .
484485 """
485486 rule_chain = rpc_rule_chain
486487 device_profile = get_default_device_profile (test_config ["tb_url" ], tb_admin_headers )
0 commit comments