Skip to content

Commit a2b7afa

Browse files
committed
Fix tests that fail with SELinux enabled
After the introduction of the `:lookup` symbol as the default value of the SELinux-related properties of the file resource, some tests now fail because they expect the file resource to not have properties with such behaviour. This commit disables SELinux for such tests. Note that the failures occur only when the tests are executed on systems with SELinux enabled (e.g CentOS).
1 parent 60c2777 commit a2b7afa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

spec/unit/resource/catalog_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
# audit only resources are unmanaged
2222
# as are resources without properties with should values
2323
it "should write its managed resources' types, namevars" do
24+
if Puppet.features.selinux?
25+
selinux = class_double('selinux', is_selinux_enabled: 0)
26+
stub_const('Selinux', selinux)
27+
end
28+
2429
catalog = Puppet::Resource::Catalog.new("host")
2530

2631
resourcefile = tmpfile('resourcefile')

spec/unit/transaction/resource_harness_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929

3030
describe "when evaluating a resource" do
3131
it "produces a resource state that describes what happened with the resource" do
32+
if Puppet.features.selinux?
33+
selinux = class_double('selinux', is_selinux_enabled: 0)
34+
stub_const('Selinux', selinux)
35+
end
36+
3237
status = @harness.evaluate(@resource)
3338

3439
expect(status.resource).to eq(@resource.ref)

0 commit comments

Comments
 (0)