summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
8707a09)
A cancelled flush returns the direct context error while the durable
write is still pending. Releasing the sync then lets final cleanup
finish normally. This protects cancellation identity and shutdown
ordering while local failure context is added elsewhere.
Issue:
3cdc678
require.ErrorIs(t, s.Close(), failure)
}
require.ErrorIs(t, s.Close(), failure)
}
+func TestFlushCancellationKeepsTheDirectContextError(t *testing.T) {
+ gate := newSyncerGatedSync()
+ s := newSyncer(gate.Sync)
+ s.Written()
+ gate.WaitStarted(t, 1)
+
+ ctx, cancel := context.WithCancel(t.Context())
+ defer cancel()
+
+ cancel()
+
+ err := s.Flush(ctx)
+ require.Equal(t, context.Canceled, err)
+
+ gate.Release()
+ require.NoError(t, s.Close())
+}
+
func TestMemoryFlushSyncsTheChat(t *testing.T) {
memory, err := openMemory(t.Context(), t.TempDir(), newTestClock().Now, newFakeSummarizer(), discardLog())
require.NoError(t, err)
func TestMemoryFlushSyncsTheChat(t *testing.T) {
memory, err := openMemory(t.Context(), t.TempDir(), newTestClock().Now, newFakeSummarizer(), discardLog())
require.NoError(t, err)