test: Db tests assert stored state instead of smoke-calling empty methods - #12693
test: Db tests assert stored state instead of smoke-calling empty methods#12693benaadams wants to merge 3 commits into
Conversation
MemDb.Flush and Dispose (and the Snapshotable variants) are empty method bodies, so the six *_does_not_cause_trouble tests could never fail; removed. The no-assert MemDb creation tests now verify the value round- trips. ReadOnlyDbProviderTests.Can_clear exercised an empty registry (no db was ever registered), making ClearTempChanges a no-op; it now registers a real MemDb-backed read-only db and asserts the overlay is dropped while the wrapped db stays intact, plus the no-writes contract when localChanges is off. Can_get_all_on_empty now asserts emptiness instead of discarding the enumeration.
|
Claude encountered an error after 3m 18s —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
Pull request overview
This PR strengthens Nethermind.Db.Test by removing tests that could not meaningfully fail (smoke-calling empty methods) and replacing assertion-free tests with checks that validate stored state and observable behavior.
Changes:
- Removed
*_does_not_cause_troubletests forFlush/Disposeon in-memory DB implementations where the methods are effectively no-ops. - Added assertions to
MemDbTestsandReadOnlyDbProviderTeststo verify round-trips, overlay clearing, and expected write behavior. - Made
DbOnTheRocksDbTests.Can_get_all_on_emptyassert the empty enumeration rather than discarding it.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Nethermind/Nethermind.Db.Test/SnapshotableMemDbTests.cs |
Removes no-op Dispose/Flush smoke tests. |
src/Nethermind/Nethermind.Db.Test/SnapshotableMemColumnsDbTests.cs |
Removes no-op Dispose/Flush smoke tests for columns DB. |
src/Nethermind/Nethermind.Db.Test/ReadOnlyDbProviderTests.cs |
Makes Can_clear assert overlay clearing / wrapped DB persistence and write expectations. |
src/Nethermind/Nethermind.Db.Test/MemDbTests.cs |
Adds assertions to previously assertion-free construction tests to verify round-trip reads. |
src/Nethermind/Nethermind.Db.Test/DbOnTheRocksTests.cs |
Ensures empty DB GetAll() is asserted as empty for both fixture variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude re-review |
|
Claude encountered an error after 3m 59s —— View job I'll analyze this and get back to you. |
|
@claude re-review |
|
Claude finished @benaadams's task in 4m 6s —— View job Re-review complete — no blocking findings
Verification performedDeletions are justified. Confirmed against source, not just the PR description:
On the Copilot review comment (
|
Changes
How to review this fast: four commits, one concern each; 5 files, all under
Nethermind.Db.Test(no product code changed); net -23 lines.*_does_not_cause_troubletests:MemDb.Flush/Disposeand theSnapshotableMemDbvariants are empty method bodies (MemDb.cs:83,100), andSnapshotableMemColumnsDb.Flush/Disposeonly loop over those empty bodies - the tests could not fail under any code change, because there is no behavior to cover.MemDbTests.Can_create_with_delays/Can_create_without_argumentshad no assertions; they now verify the written value round-trips throughGetand the batch indexer (grouped inAssert.EnterMultipleScope).ReadOnlyDbProviderTests.Can_clearcalledClearTempChanges()on a provider with an empty registry - no db was ever registered, so the method body was a no-op loop. It now registers a realMemDb-backedReadOnlyDbthrough a substitutedIDbProviderand asserts: the in-memory overlay is dropped byClearTempChangeswhile the wrapped db stays intact (localChanges: true), andSetthrowsInvalidOperationExceptionwhen writes are not expected (localChanges: false).DbOnTheRocksDbTests.Can_get_all_on_emptydiscarded the enumeration; it now assertsIs.Emptyon the per-test fresh db (bothuseColumnDbfixture variants).Part of the test-hygiene series (#12689, #12690): tests that cannot meaningfully fail get real assertions or are removed where nothing exists to cover.
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Nethermind.Db.Testsuite green locally (windows-x64, release): 1091 total, 0 failed (544 skipped are pre-existing fixture-mode guards).ReadOnlyDb.ClearTempChangesa no-op failsCan_clear(true); perturbed expectations fail the strengthened MemDb test and bothCan_get_all_on_emptyfixture variants. All mutations reverted.MemDbFactory.CreateColumnsDbandPseudoNethermindModule.Documentation
Requires documentation update
Requires explanation in Release Notes