-
Notifications
You must be signed in to change notification settings - Fork 18
Ensure FacterImpl consistency between example groups #19
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
Ensure FacterImpl consistency between example groups #19
Conversation
I tested this on the borg module and it works fine: voxpupuli/puppet-bird#87 |
Using the 'rspec' facter implementation we could sometimes get in a case where the values of FacterImpl and Puppet.runtime[:facter] diverged between example groups. Because rspec-puppet overrides facts using the FacterImpl constant (which is only set once), Puppet.runtime[:facter] would point to a different instance of FacterTestImpl with no available facts, causing calls to Puppet.runtime[:facter].value to fail. To prevent this from happening, set Puppet.runtime[:facter] to the value of FacterImpl; this way we make sure Puppet.runtime[:facter] and FacterImpl operate on the same instance of FacterTestImpl.
fdab041
to
a346ced
Compare
I restarted the CI in voxpupuli/puppet-bird#87 and the unit tests passed 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.
Thanks! Let me know if you want to address the inline comment but I'm fine with merging this.
436340a
to
614347f
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.
CI in voxpupuli/puppet-bird#87 passed 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.
Thanks!
@ciprianbadescu would it be possible to release this soonish? (this blocks a few Vox Pupuli pipelines) |
@bastelfreak 2.11.1 should be out now! |
Hello folks! I saw similar errors into 2 VoxPupuli PRs, voxpupuli/puppet-mongodb#633 and voxpupuli/puppet-windows_firewall#124 Do you think that's still related to this change? |
Using the 'rspec' facter implementation we could sometimes get in a case where the values of
FacterImpl
andPuppet.runtime[:facter]
diverged between example groups.Because rspec-puppet overrides facts using the
FacterImpl
constant (which is only set once),Puppet.runtime[:facter]
would point to a different instance ofFacterTestImpl
with no available facts, causing calls toPuppet.runtime[:facter].value
to fail.To prevent this from happening, attempt to set
Puppet.runtime[:facter]
to the value ofFacterImpl
if available, this way we make surePuppet.runtime[:facter]
andFacterImpl
operate on the same instance ofFacterTestImpl
.