mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-05 08:10:39 +00:00
Add InMemoryStore create_run retry and conflict test
Covers the idempotent retry path (same run_id + same created_at) and the conflict rejection path (same run_id + different created_at returns RunAlreadyExists). This was already tested in the SlateStore suite but missing from the InMemoryStore tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c6c227684c
commit
67f1773d4e
1 changed files with 20 additions and 0 deletions
|
|
@ -1049,4 +1049,24 @@ mod tests {
|
|||
store.delete_run("run-1").await.unwrap();
|
||||
assert!(store.open_run("run-1").await.unwrap().is_none());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn create_run_allows_retry_and_rejects_conflict() {
|
||||
let store = InMemoryStore::default();
|
||||
let ts = dt("2026-03-27T12:00:00Z");
|
||||
|
||||
// First create succeeds.
|
||||
store.create_run("run-1", ts).await.unwrap();
|
||||
|
||||
// Retry with exact same created_at succeeds (idempotent).
|
||||
store.create_run("run-1", ts).await.unwrap();
|
||||
|
||||
// Different created_at for the same run_id is rejected.
|
||||
let different_ts = dt("2026-03-27T12:00:01Z");
|
||||
match store.create_run("run-1", different_ts).await {
|
||||
Err(StoreError::RunAlreadyExists(_)) => {} // expected
|
||||
Err(other) => panic!("expected RunAlreadyExists, got: {other:?}"),
|
||||
Ok(_) => panic!("expected RunAlreadyExists, but create_run succeeded"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue