Testing Find-DbaCommand - Restore the index file the Rebuild test overwrites - #10630
Open
andreasjordan wants to merge 1 commit into
Open
Testing Find-DbaCommand - Restore the index file the Rebuild test overwrites#10630andreasjordan wants to merge 1 commit into
andreasjordan wants to merge 1 commit into
Conversation
…rwrites The "-Rebuild" test regenerates bin\dbatools-index.json in place. That file is a tracked release asset, committed only by the release process, so running the test from a git working copy left the tree permanently modified - a 13 MB binary-looking diff after every suite run. Back the file up in BeforeAll and restore it in AfterAll. The rebuild is still exercised for real and its assertion still reads the freshly generated index; only the leftover goes away. Verified via the lab harness: 7/7 green, and the working tree is clean after the run. (do Find-DbaCommand) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
potatoqualitee
approved these changes
Aug 30, 2026
potatoqualitee
left a comment
Member
There was a problem hiding this comment.
Reviewed the complete current head, index backup/restore lifecycle, test isolation behavior, and exact-head CI evidence. The normal repository test path is corrected and no material blocker was found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Find-DbaCommand.Tests.ps1runsFind-DbaCommand -Pattern snapshot -Rebuild, and the rebuild path writes the regenerated index straight overbin\dbatools-index.jsonin the module root. When the module runs from a git working copy, that overwrites a tracked release asset - the file is committed only by the release process (v2.8.0 through v2.8.4 in the history) - so every suite run left the tree with a permanent 13 MB modification.The fix stays in the test:
BeforeAllcopies the index file to the test temp directory,AfterAllcopies it back and removes the backup. The-Rebuildcoverage is unchanged - the rebuild still executes against the real file and the assertion still reads its output - only the leftover goes away. Ignoring the file instead would not work (.gitignorehas no effect on tracked files), and untracking it would change what the release ships.Verification
Ran the file via the lab harness: 7/7 green (1 unit, 6 integration), and
git statusshows a cleanbin\dbatools-index.jsonafter the run - before the fix it showed as modified after every run that included this file.created by Claude and reviewed by Andreas Jordan
🤖 Generated with Claude Code