-
Notifications
You must be signed in to change notification settings - Fork 6
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
don't stringify custom facts; require rspec-puppet-facts 3.x #131
Conversation
rspec-puppet-facts has an option to stringify all facts: https://github.com/voxpupuli/rspec-puppet-facts/blob/fd600001c1cc9cb0bd2522188f4a8feb15f7cf40/lib/rspec-puppet-facts.rb#L176 But this is called *after* our facts are added: https://github.com/voxpupuli/rspec-puppet-facts/blob/fd600001c1cc9cb0bd2522188f4a8feb15f7cf40/lib/rspec-puppet-facts.rb#L173 That means that voxpupuli-test doesn't need to care how RSpec.configuration.facterdb_string_keys is set. rspec-puppet-facts deal with it afterwards.
tested at voxpupuli/puppet-example#51 |
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.
I think these are bugs in rspec-puppet-facts. With string keys, all keys should be strings. Not some as symbols, some as strings.
everything that rspec-puppet-facts returns in the end are strings. You can see that here: https://github.com/voxpupuli/puppet-example/actions/runs/9227133359/job/25388427471?pr=51 custom facts are always added as symbols and depending on |
@@ -71,8 +71,7 @@ def add_stdlib_facts | |||
# Rough conversion of grepping in the puppet source: | |||
# grep defaultfor lib/puppet/provider/service/*.rb | |||
add_custom_fact :service_provider, ->(_os, facts) do | |||
os = RSpec.configuration.facterdb_string_keys ? facts['os'] : facts[:os] |
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.
If we set facterdb_string_keys
to true
, this must be facts['os']
. Otherwise the whole setting doesn't make sense. IMHO it's a bug.
This is the result of some poking in voxpupuli/voxpupuli-test#131 and voxpupuli/voxpupuli-test#132 (comment)
This is the result of some poking in voxpupuli/voxpupuli-test#131 and voxpupuli/voxpupuli-test#132 (comment) Tested in: voxpupuli/puppet-example#54
rspec-puppet-facts has an option to stringify all facts:
https://github.com/voxpupuli/rspec-puppet-facts/blob/fd600001c1cc9cb0bd2522188f4a8feb15f7cf40/lib/rspec-puppet-facts.rb#L176
But this is called after our facts are added:
https://github.com/voxpupuli/rspec-puppet-facts/blob/fd600001c1cc9cb0bd2522188f4a8feb15f7cf40/lib/rspec-puppet-facts.rb#L173
That means that voxpupuli-test doesn't need to care how RSpec.configuration.facterdb_string_keys is set. rspec-puppet-facts deal with it afterwards.