[DB-1951] Add MSA idempotency tests that correspond to the existing behaviour#5565
[DB-1951] Add MSA idempotency tests that correspond to the existing behaviour#5565timothycoleman wants to merge 2 commits intomasterfrom
Conversation
Review Summary by QodoAdd comprehensive MSA idempotency tests for multi-stream writes
WalkthroughsDescription• Add comprehensive idempotency test suite for multi-stream writes • Test Full, Partial, WithFailedCheck, and WithSuccessfulCheck idempotency scenarios • Test idempotent behavior across different expected versions and stream states • Test idempotent behavior when stream is modified after initial write Diagramflowchart LR
A["Test Suite Setup"] --> B["IdempotencyKind Enum"]
B --> C["IdempotentBehaviorByKindCases"]
C --> D["idempotent_behaviour_by_kind Test"]
B --> E["StreamModification Enum"]
E --> F["IdempotentBehaviorByStreamChangedCases"]
F --> G["idempotent_behavior_by_stream_change Test"]
File Changes1. src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more |
There was a problem hiding this comment.
Pull request overview
Adds a systematic set of multi-stream append idempotency tests to capture and lock in current behavior, especially around check-only streams and stream-state transitions, making future behavior changes easier to validate.
Changes:
- Introduces theory-driven test matrices for idempotent retries by “kind” (full/partial + check-only variants).
- Adds theory-driven tests for idempotent retries when the target stream changes between attempts (more events / soft-delete / tombstone).
- Introduces supporting enums and case tables to enumerate applicable (ExpectedVersion, StreamState) combinations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs
Outdated
Show resolved
Hide resolved
src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs
Outdated
Show resolved
Hide resolved
src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs
Outdated
Show resolved
Hide resolved
| Assert.Equal(expectedResult, retry.Result); | ||
|
|
There was a problem hiding this comment.
For non-success retries, this test only asserts retry.Result. Other tests in this file also assert ConsistencyCheckFailures (and often FirstEventNumbers/LastEventNumbers) to verify which stream failed and why. Adding those assertions here would make these idempotency cases much more specific and prevent regressions where the error shifts from T to the check-only stream (or vice versa).
src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
These are probably largely covered by tests elsewhere, but I wanted to have a systematic approach in one place. It'll make it easier to verify the effect of adjusting the idempotency behaviour of check-only streams