Skip to content

Commit 2cdde3d

Browse files
[router] Fix Flaky test_circuit_breaker_opens_and_recovers (#13164)
1 parent 401ed0c commit 2cdde3d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sgl-router/py_test/integration_mock/test_circuit_breaker.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,21 @@ def post_once():
3232
timeout=3,
3333
)
3434

35-
saw_503 = False
35+
# should see 500 when worker actually starts, before that should see 503
36+
saw_500 = False
3637
for _ in range(8):
38+
r = post_once()
39+
if r.status_code == 500:
40+
# Worker starts, continue to circuit breaker test
41+
saw_500 = True
42+
break
43+
assert (
44+
r.status_code == 503
45+
), "Should only see 503 when waiting for worker to start"
46+
assert saw_500, "Worker didn't start after 8 requests"
47+
48+
saw_503 = False
49+
for _ in range(4):
3750
r = post_once()
3851
if r.status_code == 503:
3952
saw_503 = True

0 commit comments

Comments
 (0)