抽取 Gin、配置、日志、数据库、Redis 与出站 HTTP 基础能力。 新增统一接入指南,将能力清单和相对链接检查纳入 make verify。 对齐远端 module 路径,修正 Redis 读写超时特殊值映射。 验证:make verify、make race-check 均通过。
This commit is contained in:
commit
b4c3ac622c
55 files changed
+5862
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package diagnostic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSnapshotPreservesCancellationAndCopiesValues(t *testing.T) {
|
||||
parent, cancel := context.WithCancel(context.Background())
|
||||
original := Snapshot{TraceID: "trusted"}
|
||||
ctx := With(parent, original)
|
||||
original.TraceID = "changed"
|
||||
snapshot := From(ctx)
|
||||
snapshot.TraceID = "local"
|
||||
if From(ctx).TraceID != "trusted" {
|
||||
t.Fatal("snapshot was modified")
|
||||
}
|
||||
cancel()
|
||||
if ctx.Err() != context.Canceled {
|
||||
t.Fatal("cancellation lost")
|
||||
}
|
||||
if From(context.Background()) != (Snapshot{}) {
|
||||
t.Fatal("created fake diagnostics")
|
||||
}
|
||||
}
|
||||