Skip to content
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-10524) Address spec failures when running with facter 4 #8165

Merged
merged 3 commits into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.summary = "Puppet, an automated configuration management tool"
s.specification_version = 3
s.add_runtime_dependency(%q<facter>, [">= 2.4.0", "< 4"])
s.add_runtime_dependency(%q<facter>, [">= 2.4.0", "< 5"])
s.add_runtime_dependency(%q<hiera>, [">= 3.2.1", "< 4"])
s.add_runtime_dependency(%q<semantic_puppet>, "~> 1.0")
s.add_runtime_dependency(%q<fast_gettext>, "~> 1.1")
Expand Down
1 change: 1 addition & 0 deletions spec/unit/indirector/catalog/compiler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def a_request_that_contains(facts)
end

it "should add 'pe_serverversion' when PE" do
allow(File).to receive(:readable?).and_call_original
allow(File).to receive(:readable?).with(pe_version_file).and_return(true)
allow(File).to receive(:zero?).with(pe_version_file).and_return(false)
allow(File).to receive(:read).and_call_original
Expand Down
1 change: 1 addition & 0 deletions spec/unit/provider/service/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@

describe "if the init script is present" do
before :each do
allow(File).to receive(:directory?).and_call_original
allow(File).to receive(:directory?).with("/service/path").and_return(true)
allow(File).to receive(:directory?).with("/alt/service/path").and_return(true)
allow(Puppet::FileSystem).to receive(:exist?).with("/service/path/myservice").and_return(true)
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/provider/service/openbsd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
allow(FileTest).to receive(:executable?).with('/usr/sbin/rcctl').and_return(true)
end

before(:all) do
`exit 0`
end

context "#instances" do
it "should have an instances method" do
expect(provider_class).to respond_to :instances
Expand Down
1 change: 1 addition & 0 deletions spec/unit/provider/service/openwrt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
allow(FileTest).to receive(:executable?).with('/etc/rc.common').and_return(true)

# All OpenWrt tests operate on the init script directly. It must exist.
allow(File).to receive(:directory?).and_call_original
allow(File).to receive(:directory?).with('/etc/init.d').and_return(true)

allow(Puppet::FileSystem).to receive(:exist?).with('/etc/init.d/myservice').and_return(true)
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/provider/service/redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
if: Puppet.features.posix? && !Puppet::Util::Platform.jruby?do
let(:provider_class) { Puppet::Type.type(:service).provider(:redhat) }

before(:all) do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @IrimieBogdan ! Could you add a comment to the code here explaining why we have to do this? I can see someone getting really confused a year from now as to why this is needed :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comments describing the fix and why it is required.

`exit 0`
end

before :each do
@class = Puppet::Type.type(:service).provider(:redhat)
@resource = double('resource')
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/provider/service/systemd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
allow(provider_class).to receive(:which).with('systemctl').and_return('/bin/systemctl')
end

before(:all) do
`exit 0`
end

let :provider do
provider_class.new(:name => 'sshd.service')
end
Expand Down