test(testhealth): 替身竞态加锁 + 墙钟断言硬度(M33)
四处测试健康债务,只改 *_test.go,不动生产代码、不降并发: - channelbridge:stubChatter / stubSessions 的跨 goroutine 字段一律经 mu 访问 (Run/GetOrCreate 在车道 worker 上写、测试 goroutine 读,两者无 happens-before; 负向断言「等一会儿再看循环有没有被驱动」尤其如此)。读写走访问器,Messages() 返回副本;t.Parallel 与并发度不变。 - plugins/tools/io:claimProbeTimeout 2s(真实时间预算)→ 60s,并由 claimProbeWait 按 t.Deadline 收缩。探针只等 goroutine 被调度(无时间语义),放大余量把 「机器快慢」从断言里去掉,死锁仍以断言失败暴露。 - backthink:TestSelfWakeGate_WindowExpiry 窗口 120ms → 6s(给 waitFor 的 4s 上界 留 2s 余量),到期等待改为按首次受理时刻推算 window+250ms,不再盲睡 3×窗口。 另修 TestSelfWakeStatus_MatchesReceiptAndTracksPendingSlot:worker 先 take 再进 Think,卡 Think 并不占待跑槽 —— 改为「上一轮把 worker 占住再断言 Pending」。 - memory:墙钟实测用例显式给闸 5s 预算(measureGateBudget),不再因默认 150ms 超时 fail-open 打炸「每轮都真扫真判」前置断言;并把 GateFailed 纳入该断言。
This commit is contained in:
1 parent
da6a365222
commit
7d9b2132bb
18 files changed
+407
-242
No files matched your search
@@ -177,8 +177,8 @@ func TestGroupMemberIsAlwaysLabeledInTheThirdPartyLane(t *testing.T) {
|
||||
nameless := namedGroupMessage("9", "", adapter.Actor{Role: adapter.RoleMember})
|
||||
b.process(context.Background(), nameless)
|
||||
|
||||
if len(chat.messages) != 2 || chat.messages[1].SenderName != "9" {
|
||||
t.Fatalf("loop messages = %+v, want the nameless member labeled with its uid", chat.messages)
|
||||
if len(chat.Messages()) != 2 || chat.Messages()[1].SenderName != "9" {
|
||||
t.Fatalf("loop messages = %+v, want the nameless member labeled with its uid", chat.Messages())
|
||||
}
|
||||
recs := hist.records()
|
||||
if len(recs) != 2 || recs[0].SenderName != "9" {
|
||||
@@ -203,8 +203,8 @@ func TestOwnerGroupMessageCarriesNoThirdPartyLabel(t *testing.T) {
|
||||
}
|
||||
b.process(context.Background(), namedGroupMessage("100", "主人", adapter.Actor{Role: adapter.RoleOwner}))
|
||||
|
||||
if len(chat.messages) != 2 || chat.messages[1].SenderName != "" {
|
||||
t.Fatalf("loop messages = %+v, want the owner's message unlabeled", chat.messages)
|
||||
if len(chat.Messages()) != 2 || chat.Messages()[1].SenderName != "" {
|
||||
t.Fatalf("loop messages = %+v, want the owner's message unlabeled", chat.Messages())
|
||||
}
|
||||
recs := hist.records()
|
||||
if len(recs) != 2 || recs[0].SenderName != "" {
|
||||
|
||||
Reference in new issue
Block a user