Skip to content

Commit 5a33635

Browse files
committed
Mock Debian OS in SystemD test
In e660355, we added an additional test for nonexistent services, including a test for a Debian-specific code path that runs invoke-rc.d. Because this code path is only invoked on Debian systems, this test would regularly fail for any other platforms. This commit mocks the os.family fact for the nonexistent services tests.
1 parent c23ba2a commit 5a33635

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

spec/unit/provider/service/systemd_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@
335335

336336
it "should consider nonexistent services to be disabled" do
337337
provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist'))
338+
allow(Facter).to receive(:value).with('os.family').and_return('debian')
338339
expect(provider).to receive(:execute).with(['/bin/systemctl','is-enabled', '--', 'doesnotexist'], {:failonfail => false})
339340
.and_return(Puppet::Util::Execution::ProcessOutput.new("", 1))
340341
expect(provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], {:failonfail => false})

0 commit comments

Comments
 (0)