-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
(maint) replace legacy facts in service provider #8868
Conversation
Can one of the admins verify this patch? |
I'm not really sure how to mock the structured facts in rspec :( |
This causes issues with spec testing puppet modules on a regular basis. It's not guaranteed that new factsets from facterdb have legacy facts because, well, Puppet Inc declared them legacy and in many places they are opt-in. We (Vox Pupuli) spent alot of time adding some legacy facts back to some factsets, but it's inconsistent. I think they shouldn't be used anymore.
843acb5
to
0f9f09e
Compare
not pretty but this is what i have done in the past Also worth pointing out FACT-2913 |
We tried doing this earlier and had to revert back because it broke tests that were only stubbing the legacy fact, but not the equivalent structured fact. So I don't think this is something that can land in a 7.x release. Also Puppet recently added the ability to inject a facter implementation, see (PUP-11216). When using puppet as a library, such as when testing a module, it's now possible for facts = load fact fixtures, e.g. from https://raw.githubusercontent.com/voxpupuli/facterdb/master/facts/4.2/almalinux-8-x86_64.facts
facter_impl = TestFacterImpl.new(facts)
Puppet.initialize_settings(['arg1', 'arg2', ..], true, true, {facter: facter_impl}) This way the test can completely stub whatever facts are needed for the test. One exception is if a module's type/provider is calling I think the path forward would be something like:
Thoughts? /cc @binford2k |
At least the starts of the test implementation went in with puppetlabs/rspec-puppet#16 I did a quick scan and here's a list of all the Forge modules that invoke If we wanted to, I could script out an "update the world" bot to propose PRs to the new API. |
you say that "just" because it's time consuming to update the tests? It shouldn't be a breaking change, or am I missing something? @binford2k if the bot can provide a working PR, I'm +100000 for that. |
Thanks @bastelfreak We ended up fixing this in 82cef23 so I'm going to close this. |
This causes issues with spec testing puppet modules on a regular basis.
It's not guaranteed that new factsets from facterdb have legacy facts
because, well, Puppet Inc declared them legacy and in many places they
are opt-in. We (Vox Pupuli) spent alot of time adding some legacy facts
back to some factsets, but it's inconsistent. I think they shouldn't be
used anymore.