-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handling merging structured facts #109
Comments
Thanks for raising this @gerases! rspec-puppet/lib/rspec-puppet/support.rb Line 205 in 2ab0d16
add_custom_fact method (see here), so hopefully that should serve as a workaround until we get this implemented.
|
Thanks @jordanbreen28, for various reasons using |
@gerases No worries! yes i believe that is the approach we will take :) (yet to test it out so could change..) |
@gerases can you elaborate why you cannot use rspec-puppet-facts? |
Use Case
I’m curious if anyone has run into the following problem. If one has their custom puppet modules in one big git repo and then also rspec-puppet tests for each, then at some point, to avoid repetition, one might want to put certain default facts in some spec helper and include it in each test, something like this:
This works … until some rspec within the module does this:
What happens then is that the
:os
dictionary indefault_facts
becomes overwritten (no deep merge).Is there a known, elegant solution to this?
Describe the Solution You Would Like
An elegant way for module level tests to merge their facts with default fact dictionaries.
Describe Alternatives You've Considered
I've written a
deep_merge
function that deep merges the module-level dictionary with a global dictionary with some defaults. Like so:The text was updated successfully, but these errors were encountered: