summaryrefslogtreecommitdiff
path: root/spec
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
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')
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/support/platform_helpers.rb4
-rw-r--r--spec/support/shared/unit/provider/file.rb11
3 files changed, 14 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2f6747c9af..55b0a9c3f6 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -152,6 +152,7 @@ RSpec.configure do |config|
config.filter_run_excluding :unix_only => true unless unix?
config.filter_run_excluding :aix_only => true unless aix?
config.filter_run_excluding :debian_family_only => true unless debian_family?
+ config.filter_run_excluding :linux_only => true unless linux?
config.filter_run_excluding :supports_cloexec => true unless supports_cloexec?
config.filter_run_excluding :selinux_only => true unless selinux_enabled?
config.filter_run_excluding :requires_root => true unless root?
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