@@ -632,27 +632,27 @@ def test_k8s_multi_deploy():
632632 print ("OK" )
633633
634634
635- def _wait_multi_role_replicas (expected , label = "app.kubernetes.io/component=exapp" , timeout_sec = 30 ):
635+ def _wait_multi_role_replicas (expected , label = "app.kubernetes.io/component=exapp" , timeout_sec = 90 ):
636636 """Poll until all multi-role deployments reach the expected replica count."""
637- for _ in range (timeout_sec // 2 ):
637+ last_state = ""
638+ for attempt in range (timeout_sec // 3 ):
638639 deploy_json = kubectl_output (f"get deploy -l { label } -o json" , check = False )
639640 data = json .loads (deploy_json )
640641 items = data .get ("items" , [])
641642 if len (items ) >= 2 and all (
642643 item ["spec" ].get ("replicas" , - 1 ) == expected for item in items
643644 ):
644645 return items
645- time .sleep (2 )
646+ last_state = ", " .join (
647+ f"{ item ['metadata' ]['name' ]} ={ item ['spec' ].get ('replicas' , '?' )} "
648+ for item in items
649+ )
650+ time .sleep (3 )
646651 # Final check with assertion
647- deploy_json = kubectl_output (f"get deploy -l { label } -o json" , check = False )
648- data = json .loads (deploy_json )
649- items = data .get ("items" , [])
650- assert len (items ) >= 2 , f"Expected 2+ deployments, got { len (items )} "
651- for item in items :
652- replicas = item ["spec" ].get ("replicas" , - 1 )
653- name = item ["metadata" ]["name" ]
654- assert replicas == expected , f"Expected { expected } replicas for { name } , got { replicas } "
655- return items
652+ assert False , (
653+ f"Timed out waiting for replicas={ expected } after { timeout_sec } s. "
654+ f"Last state: { last_state } "
655+ )
656656
657657
658658def test_k8s_multi_enable_disable ():
@@ -663,7 +663,7 @@ def test_k8s_multi_enable_disable():
663663 r = occ ("app_api:app:disable app-skeleton-python" , check = False , timeout = 120 )
664664 assert r .returncode == 0 , f"Disable failed: { r .stdout .decode ()} "
665665
666- # Verify all deployments scaled to 0 (poll to avoid race)
666+ # Verify all deployments scaled to 0 (poll to avoid race with HaRP-to-K8s propagation )
667667 _wait_multi_role_replicas (0 )
668668
669669 # Verify AppAPI shows disabled
0 commit comments