Skip to content
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

Collect facts iteratively #152

Merged
merged 1 commit into from
Jul 20, 2023
Merged

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Jul 5, 2023

Rather than getting the facts for every filter spec and then discarding that, this stores the found facts in an array and uses that.

This eliminates a call to FacterDB::get_facts with a very complex filter.

A quick test in puppet-nginx reduces loading of tests by about 2 seconds (from ~9 to ~7).

This is a reworked version of #124 for a clean changelog. It requires #151 to be merged first.

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (1c8a717) 95.23% compared to head (2bfaa90) 95.20%.

❗ Current head 2bfaa90 differs from pull request most recent head 58fa0a4. Consider uploading reports for the commit 58fa0a4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   95.23%   95.20%   -0.03%     
==========================================
  Files           2        2              
  Lines         168      167       -1     
==========================================
- Hits          160      159       -1     
  Misses          8        8              
Impacted Files Coverage Δ
lib/rspec-puppet-facts.rb 98.14% <100.00%> (-0.02%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ekohl ekohl mentioned this pull request Jul 5, 2023
@ekohl ekohl force-pushed the reuse-found-facts branch 3 times, most recently from 0b0114e to d1f69b9 Compare July 7, 2023 13:37
@ekohl
Copy link
Member Author

ekohl commented Jul 7, 2023

Test failure is because it no longer does the additional get_facts call, which was the whole point.

Rather than getting the facts for every filter spec and then discarding
that, this stores the found facts in an array and uses that.

This eliminates a call to FacterDB::get_facts with a very complex
filter.

A quick test in puppet-nginx reduces loading of tests by about 2 seconds
(from ~9 to ~7).
@ekohl ekohl marked this pull request as ready for review July 20, 2023 15:20
@ekohl ekohl merged commit 5c92f4f into voxpupuli:master Jul 20, 2023
@ekohl ekohl deleted the reuse-found-facts branch July 20, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants