[chore][cmd/builder] Improve missing replace statements test #10196
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.
Description
Updates
TestReplaceStatementsAreComplete
to check the modules used in replace statements to ensure that their dependencies also have replace statements. This will catch the error that happened in #10188 before a release is started.The one caveat here is that the test may need to be run multiple times if there are modules deep in the dependency tree that haven't been added to the list of replace statement modules. In essence, the user has to do a BFS walk of the dependency tree themselves by running the tests until all missing modules are caught. We could automate this process with additional code to report all missing modules at once regardless of depth, but I figure it's not worth the extra complexity in the test for such a small gain.
Testing
I tested this on the #10188 branch by removing the
pdata/testdata
module from the replace statements list and seeing that the failure is easier to understand: