refactor: S24.10 rename file→block in BlockStore test names and comments#452
Conversation
The BlockStore tests leaked `file`/`File` naming into test identifiers and block-index comments, conflating the BlockStore abstraction (over an injected BlockDevice) with the `FileBlockDevice` concrete adapter. Production code was already clean; this only touches three test files. - BlockStoreTest.cpp: 13 test names renamed (e.g. WriteRotatesToNewFileWhenFull → …NewBlockWhenFull, MaxFilesAtUpperLimit → MaxBlocksAtUpperLimit), ~30 `/* file NN */` block-index comments changed to `/* block NN */`, and the "File rotation" / "Resume from existing file" section headers renamed. - BlockStorePosixTest.cpp: DiscardOldestWhenReadIsPartwayThroughOldestFile → …OldestBlock, plus 10 block-index comments. - BlockStoreDrainOrderingTest.cpp: fixture comment header reworded. The fixture members `file` (a `SolidSyslogFile*`) and `device` (the `SolidSyslogBlockDevice*`) are kept as-is — `file` is genuinely a SolidSyslogFile pointer used by many tests for file-layer assertions (`SolidSyslogFile_Exists`) and fault injection (`FileFake_FailNextOpen`, etc.), so the name is accurate. The fixture comment is extended to make that intent explicit. The PosixTest doc-comment "real POSIX files" and the `CleanStoreFiles()` helper are kept — that integration test genuinely is about files on disk. All 1332 tests pass under the debug preset. Closes #449
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 36 minutes and 19 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1338 passed) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
Summary
The BlockStore tests leaked
file/Filenaming into test identifiers and block-index comments, conflating the BlockStore abstraction (over an injected BlockDevice) with theFileBlockDeviceconcrete adapter. Production code was already clean; this is a test-only rename.BlockStoreTest.cpp— 13 test names renamed (WriteRotatesToNewFileWhenFull→…NewBlockWhenFull,MaxFilesAtUpperLimit→MaxBlocksAtUpperLimit, etc.), ~30/* file NN */block-index comments changed to/* block NN */, and the "File rotation" / "Resume from existing file" section headers renamed.BlockStorePosixTest.cpp—DiscardOldestWhenReadIsPartwayThroughOldestFile→…OldestBlock, plus 10 block-index comments.BlockStoreDrainOrderingTest.cpp— fixture comment header reworded.Deliberate non-changes
The story body suggested renaming the fixture member
file→device/blockDevice. On close inspection that's not workable:deviceis already a member (theSolidSyslogBlockDevice*); renaming the file member todevicewould collide.fileis genuinely aSolidSyslogFile*— used by many tests for file-layer assertions (SolidSyslogFile_Exists(file, ...)) and fault injection (FileFake_FailNextOpen(file),FileFake_FailNextWrite(file), etc.). The right name for aSolidSyslogFile*variable isfile.The fixture comment is extended to make that intent explicit. Test bodies that assert file-layer side effects of BlockStore operations continue to use
filecorrectly.The PosixTest doc-comment about "real POSIX files" and the
CleanStoreFiles()helper are also kept — that integration test genuinely is about files on disk.Test plan
cmake --preset debug && cmake --build --preset debug --target junit— 1332 tests passMaxBlocksAtUpperLimit,WriteRotatesToNewBlockWhenFull,CreatesFirstBlockOnInit, etc.)clang-format -iapplied to touched filescmake --build --preset cppcheck— green (no new MISRA findings from rename)// cppcheck-suppresscomments which move with their line)Closes #449