-
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
(PUP-11022) Resolve order dependent test failures #8567
Conversation
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.
Confirmed that this fixed all of the failures for me!
cb6940a
to
46865d5
Compare
Newer facter versions call Dir.entries during fact resolution/provider loading, so call the original method by default. This fixes errors of the form: #<Dir (class)> received :entries with unexpected arguments expected: ("tmp") got: ("/Users/josh/.facter/facts.d")
The additional_resource_generator_spec.rb test removes the `generator` type that both it and the transaction_spec.rb defined. Change the latter to register a different name. This resolves errors like: Failure/Error: Puppet::Type.type(:generator).new :title => "generator" } NoMethodError: undefined method `new' for nil:NilClass
Fix order dependent test failures when running spec/unit/util/selinux_spec.rb followed by spec/unit/transaction_spec.r:b Failure/Error: expect(Selinux).to receive(:matchpathcon_fini) Selinux does not implement: matchpathcon_fini stub_const/hide_const automatically restore the previous value when the test completes.
Fix order dependent test when running spec/integration/application/plugin_spec.rb followed by spec/unit/gettext/config_spec.rb. The former disables i18n due to the settings hook, and that breaks assumptions made by the latter.
46865d5
to
a6f2b56
Compare
@@ -83,6 +83,7 @@ | |||
allow(provider_class).to receive(:defpath).and_return('tmp') | |||
|
|||
@services = ['one', 'two', 'three', 'four', 'umountfs'] | |||
allow(Dir).to receive(:entries).and_call_original |
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 was a bit worried why this surfaced just know. Seems that is reproducible only if you have the default external facts dir created($HOME/.facter/facts.d
). On Facter.value
, Facter tries to load external facts so this means that a call to Facter.value
goes to the system. I would expect this would also have failed with Facter 4.0.52.
The call that is not stubbed is coming from ./lib/puppet/provider/service/init.rb:57:in 'excludes'
so i believe a better fix would be to stub Facter.value
in https://github.com/puppetlabs/puppet/blob/main/spec/unit/provider/service/init_spec.rb#L81-L82
@@ -80,6 +80,7 @@
describe "when getting all service instances" do
before :each do
+ allow(Facter).to receive(:value).with(:osfamily).and_return('redhat')
allow(provider_class).to receive(:defpath).and_return('tmp')
@services = ['one', 'two', 'three', 'four', 'umountfs']
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.
👍 sounds good, I'll take a look today
This resolves order dependent test failures seen when running:
There will be merge conflicts when merging to main, I'll take care of that after this passes CI