newTestProxy wires a CacheProxy with no peers and a tempdir-backed store.
(t *testing.T)
| 87 | prev := slog.Default() |
| 88 | buf := &syncBuffer{} |
| 89 | slog.SetDefault(slog.New(slog.NewTextHandler(buf, &slog.HandlerOptions{Level: slog.LevelDebug}))) |
| 90 | return buf, func() { slog.SetDefault(prev) } |
| 91 | } |
| 92 | |
| 93 | // syncBuffer serializes slog-handler Write calls from proxy goroutines |
| 94 | // against String reads from the test goroutine. |
| 95 | type syncBuffer struct { |
| 96 | mu sync.Mutex |
| 97 | buf bytes.Buffer |
| 98 | } |
no test coverage detected