(t *testing.T)
| 244 | } |
| 245 | |
| 246 | func TestAPIDispatcher_ProbeLatency(t *testing.T) { |
| 247 | t.Parallel() |
| 248 | d := NewAPIDispatcher(newTestAPI(), nil) |
| 249 | // 给一个会很快超时的 ctx,避免实际网络访问。 |
| 250 | ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) |
| 251 | defer cancel() |
| 252 | body, err := d.Handle(ctx, "ProbeLatency", nil) |
| 253 | if err != nil { |
| 254 | t.Fatalf("err: %v", err) |
| 255 | } |
| 256 | if !json.Valid(body) { |
| 257 | t.Fatalf("invalid body: %s", body) |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | // ── ConfigHasher 测试 ──────────────────────────────────────────── |
| 262 |
nothing calls this directly
no test coverage detected