Skip to content

Commit e125c7e

Browse files
committed
test: add test coverage for expired/evicted event payloads in replay
1 parent 49e20a4 commit e125c7e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/server/contrib/test_redis_event_store.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ async def test_replay_skips_priming_events(store):
163163
assert events[0].event_id == id3
164164

165165

166+
@pytest.mark.anyio
167+
async def test_replay_skips_expired_event_payloads(store, redis_client):
168+
anchor = await store.store_event("stream-A", SAMPLE_MSG)
169+
id2 = await store.store_event("stream-A", SAMPLE_MSG)
170+
id3 = await store.store_event("stream-A", SAMPLE_MSG)
171+
172+
# Manually delete the event key for id2 from Redis, but keep it in the sorted set
173+
await redis_client.delete(f"test:event:{id2}")
174+
175+
events, _ = await collect_events(store, anchor)
176+
177+
# Replay should skip id2 (since its payload was deleted/expired) and return only id3
178+
assert len(events) == 1
179+
assert events[0].event_id == id3
180+
181+
166182
@pytest.mark.anyio
167183
async def test_replay_events_are_in_ascending_order(store):
168184
anchor = await store.store_event("stream-A", SAMPLE_MSG)

0 commit comments

Comments
 (0)