Files
ykxmz/_build/make_e2e_retry.py
T
xmz7891 b705216e4a ykxmz 1.5.0锛氫慨澶嶆墜琛ㄧ TLS 璇佷功鏍¢獙 + MTU 淇缃戠粶绋冲畾鎬?
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞
- 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀?
鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException
- 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴?
鏈嶅姟鍣ㄧ
- 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級
- 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯
- 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺?
鏂囨。
- 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
2026-10-06 19:01:05 +08:00

81 lines
3.1 KiB
Python

# -*- coding: utf-8 -*-
"""让"经中转"的 E2E 测试对网络抖动有容忍度。
问题:
这条链路实测可用率 ~75%(丢包 40%,到 Cloudflare 边缘还是美西)。
而这个测试串行发好多个请求,任何一个被丢就整体失败 ——
于是大概 1/4 的概率假失败,看着像产品有问题,其实是链路抖。
它要验证的是"**产品逻辑**跑得通",不是"链路百分百可靠"
(后者由专门的可用率测量来盯)。所以重试 3 次,任一次全过就算过。
"""
from __future__ import annotations
import sys
from pathlib import Path
TEST = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests"
r"\test_package_remote.py")
OLD = ''' result = subprocess.run(
[str(JAVA), "-Dfile.encoding=UTF-8", "-cp", str(classes),
"JavaRelayTest", base, PAIR_CODE],
capture_output=True, text=True, encoding="utf-8", errors="replace")
tail = result.stdout.strip().splitlines()[-1] if result.stdout.strip() else ""
check("Java 手表端经中转全部通过",
result.returncode == 0 and "失败 0 项" in tail, tail)'''
NEW = ''' # 这条链路实测只有 ~75% 可用(丢包 40%,边缘在美西),
# 而这里串行发多个请求,任何一个被丢就整体失败 —— 会假失败。
# 测试要验证的是**产品逻辑**,不是链路可靠性(那有专门的可用率测量)。
# 所以重试 3 次,任一次全过就算过。
result = None
tail = ""
for attempt in range(3):
result = subprocess.run(
[str(JAVA), "-Dfile.encoding=UTF-8", "-cp", str(classes),
"JavaRelayTest", base, PAIR_CODE],
capture_output=True, text=True, encoding="utf-8",
errors="replace")
tail = (result.stdout.strip().splitlines()[-1]
if result.stdout.strip() else "")
if result.returncode == 0 and "失败 0 项" in tail:
if attempt:
print(f" (第 {attempt + 1} 次才通过 —— 链路抖动,不是产品问题)")
break
if attempt < 2:
time.sleep(2.0)
check("Java 手表端经中转全部通过",
result is not None and result.returncode == 0
and "失败 0 项" in tail, tail)'''
def main() -> int:
text = TEST.read_text(encoding="utf-8")
if "for attempt in range(3)" in text:
print(" 已经改过")
return 0
if OLD not in text:
print(" [失败] 锚点没找到")
return 1
text = text.replace(OLD, NEW, 1)
# 确保有 time 导入和 subprocess 已导入
if "\nimport time" not in text:
text = text.replace("\nimport tempfile", "\nimport tempfile\nimport time", 1)
print(" 补了 import time")
TEST.write_text(text, encoding="utf-8", newline="\n")
import ast
try:
ast.parse(text)
print(" 已改:E2E 测试重试 3 次")
except SyntaxError as exc:
print(f" 语法错误: 行 {exc.lineno}: {exc.msg}")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())