summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-07-19 14:49:41 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-07-19 14:49:41 -0700
commitbad96f846718685302fec9e627471b68cd9bab8f (patch)
tree389123e360546449c87ea051d2cc2539d0f2cc01 /spec/support
parentdc5aa2759006f7cdb58bd085d64e3a6051b3158e (diff)
downloadchef-bad96f846718685302fec9e627471b68cd9bab8f.tar.gz
only work around resolver caching on linux
it should be the only O/S which needs it due to the way its glibc was written. it is the only O/S that we've recieved any bugs for.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/platform_helpers.rb4
-rw-r--r--spec/support/shared/unit/provider/file.rb11
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 9ba56a15e3..783429161a 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -138,6 +138,10 @@ def freebsd?
!!(RUBY_PLATFORM =~ /freebsd/)
end
+def linux?
+ !!(RUBY_PLATFORM =~ /linux/)
+end
+
def debian_family?
!!(ohai[:platform_family] == "debian")
end
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 0959406583..9f84111eac 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -693,13 +693,20 @@ shared_examples_for Chef::Provider::File do
end
end
end
- context "when managing /etc/resolv.conf" do
+ context "when managing /etc/resolv.conf", linux_only: true do
let(:resource_path) { "/etc/resolv.conf" }
- it "reloads the nameservers" do
+ it "reloads the nameservers on linux" do
expect(Resolv::DefaultResolver).to receive(:replace_resolvers)
provider.send(:do_resolv_conf_fixup)
end
end
+ context "when managing /etc/resolv.conf", linux_only: false do
+ let(:resource_path) { "/etc/resolv.conf" }
+ it "does not reload the nameservers on non-linux" do
+ expect(Resolv::DefaultResolver).not_to receive(:replace_resolvers)
+ provider.send(:do_resolv_conf_fixup)
+ end
+ end
end
end