Skip to content

Commit 92f5213

Browse files
committed
test(engine): pin 住解不开的凭证,让「跳过它」这条分支必被覆盖
CI(ubuntu)上 executor 的解密失败分支没被覆盖:选号顺序取决于健康度 / 在途数 / 到期额度等动态因素,本地恰好先选到坏凭证、CI 上恰好没有。 测试不能靠动态排序碰巧——pin 住坏的那条,选号必定先试它。 钉住的行为:解不开的凭证被跳过 → 改用好凭证 → 请求成功。
1 parent 3536613 commit 92f5213

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎tests/engine/test_executor_stats.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ async def test_stream_skips_undecryptable_credential_and_uses_another(repo):
195195
with db.transaction() as conn:
196196
conn.execute("UPDATE credentials SET data_enc = ? WHERE id = ?",
197197
(other.encrypt(b'{"bearer_token": "t"}'), broken))
198+
# **pin 住坏的那条**:选号必须先试它,否则「跳过解不开的凭证」这条分支
199+
# 根本不会执行——而选号顺序取决于健康度 / 在途数 / 到期额度等一堆
200+
# 动态因素,测试不能靠它们碰巧(CI 上曾因此漏测)。
201+
assert credentials.set_pinned(broken) is True
198202

199203
collector = RecordingCollector()
200204
executor = _exec_with_stats(repo, [GOOD_EVENTS], collector)

0 commit comments

Comments
 (0)