Test that a reconciliation pass logs nothing once cancelled
check / check (push) Waiting to run

A reconciliation pass run with an already cancelled context logs no
warning, so a periodic tick the eviction loop takes after a stop adds
no warning to the one from the pass the stop interrupted.

Model: opus-5-5
This commit is contained in:
2026-10-04 06:49:02 +00:00
parent b9d32985f6
commit fbe45af544
@@ -1077,6 +1077,30 @@ func TestReconciliationWalksStopOnceCancelled(t *testing.T) {
} }
} }
// TestReconciliationPassLogsNoWarningOnceCancelled checks that a
// reconciliation pass run with an already cancelled context logs no
// warning, so a periodic tick the loop takes after a stop adds no
// warning to the one from the pass the stop interrupted.
func TestReconciliationPassLogsNoWarningOnceCancelled(t *testing.T) {
t.Parallel()
cache, _ := newEvictionTestCache(t, 1<<30)
var logBuf bytes.Buffer
cache.log = slog.New(slog.NewJSONHandler(&logBuf, nil))
ctx, cancel := context.WithCancel(t.Context())
cancel()
cache.runReconciliationPass(ctx)
t.Logf("log output: %s", logBuf.String())
if strings.Contains(logBuf.String(), `"level":"WARN"`) {
t.Errorf("runReconciliationPass logged a warning with a cancelled context")
}
}
// TestEvictSourceBlobExcludesConcurrentStoreOfIdenticalContent exercises // TestEvictSourceBlobExcludesConcurrentStoreOfIdenticalContent exercises
// the exact TOCTOU window between evictSourceBlob's row-deletion // the exact TOCTOU window between evictSourceBlob's row-deletion
// transaction commit and its content file unlink: a concurrent // transaction commit and its content file unlink: a concurrent