Files
CLIProxyAPI/internal/cache/issue6332_export_test.go
Luis Pater c997cbb58a feat(httpwire): introduce error-aware response flushing helper
- Add `FlushResponse` to prefer error-aware flushing and unwrap wrapped response writers
- Bypass Gin's void `Flush` while maintaining header accounting via `WriteHeaderNow` to keep transport errors observable

Closes: #6332
2026-10-04 17:33:19 +08:00

25 lines
725 B
Go

package cache
import (
"sync/atomic"
"testing"
)
// Issue6332BlockCommit pauses the first commit before it can update the ledger.
// This hook exists only in the test binary.
func Issue6332BlockCommit(t *testing.T) (<-chan struct{}, chan<- struct{}, func() int32) {
t.Helper()
original := currentAntigravityReasoningReplayKVClient
entered, release := make(chan struct{}), make(chan struct{})
var calls atomic.Int32
currentAntigravityReasoningReplayKVClient = func() (antigravityReasoningReplayKVClient, bool, error) {
if calls.Add(1) == 2 {
close(entered)
<-release
}
return original()
}
t.Cleanup(func() { currentAntigravityReasoningReplayKVClient = original })
return entered, release, calls.Load
}