-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
test: replace some install_test_formula with setup_test_formula #21174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR optimizes integration test performance by replacing install_test_formula with setup_test_formula in select test files. The setup_test_formula helper creates the necessary formula and tab files without executing the full installation process (prelude, fetch, install, finish), reducing test execution time by 50% or more for tests that don't require actual formula installation.
Key changes:
- Replaced
install_test_formulawithsetup_test_formulain tests that only need formula metadata or tab file attributes - Streamlined tab attribute setup by using
setup_test_formula's built-intab_attributesparameter instead of manual tab manipulation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/test/formula_info_spec.rb | Converted to use setup_test_formula in a let block since FormulaInfo.lookup only needs the formula path, not a full installation |
| Library/Homebrew/test/cmd/autoremove_spec.rb | Replaced verbose install_test_formula + manual tab manipulation with concise setup_test_formula using tab_attributes parameter to create test fixtures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d359c56 to
3ff5b9e
Compare
We can fake an install with just a tab file to avoid the overhead needed to run all of `install_test_formula`. This reduces time for modified test cases by 50% or more.
3ff5b9e to
dfdef32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a great idea. My guess is this is much faster? Any benchmarks yet? brew tests --profile, e.g. brew tests --ruby-prof or hyperfine may help here.
For the specific tests, it is faster, e.g.
The total time is going to depend on interleaving of tests as some unmodified tests like I haven't found a good way to reduce some overhead on those. Was profiling them but not able to analyze the 2nd brew instance that gets run via |
|
@cho-m huge improvement, nice work! |
|
Going to merge this and continue looking into other slow parts of test in follow ups. Hoping to remove unnecessary steps on test side to help identify places where EDIT: As note, I've verified all modified tests perform faster than original. |
|
Actually removed from queue to trigger Copilot review as it may not have run during time I converted to draft. EDIT: Review is complete with no new comments, so starting merge again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
brew lgtm(style, typechecking and tests) with your changes locally?We can fake an install with just a tab file to avoid the overhead needed to run all of
install_test_formula.