MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestSweep_DoesNotDeleteRecentInProgress

Function TestSweep_DoesNotDeleteRecentInProgress

internal/idempotency/store_test.go:273–292  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

271}
272
273func TestSweep_DoesNotDeleteRecentInProgress(t *testing.T) {
274 store, userID, _ := newStoreAndUser(t)
275 ctx := context.Background()
276
277 hash := idempotency.HashBody([]byte(`{"a":1}`))
278 first, _ := store.Claim(ctx, userID, "key-sweep-active", "/api/v1/send", hash)
279 if first.Outcome != idempotency.OutcomeAcquired {
280 t.Fatalf("first Outcome = %d", first.Outcome)
281 }
282
283 if _, err := store.Sweep(ctx); err != nil {
284 t.Fatalf("Sweep: %v", err)
285 }
286
287 // Active in_progress claim must survive sweep.
288 second, _ := store.Claim(ctx, userID, "key-sweep-active", "/api/v1/send", hash)
289 if second.Outcome != idempotency.OutcomeInFlight {
290 t.Errorf("Outcome = %d, want OutcomeInFlight (sweep should have kept active claim)", second.Outcome)
291 }
292}
293
294func TestClaim_ConcurrentSameKeyOnlyOneAcquires(t *testing.T) {
295 store, userID, _ := newStoreAndUser(t)

Callers

nothing calls this directly

Calls 4

HashBodyFunction · 0.92
newStoreAndUserFunction · 0.85
SweepMethod · 0.80
ClaimMethod · 0.65

Tested by

no test coverage detected